Skip to main content
Debug mode prints SDK logs from the same runtime where your agent runs. Use it when a trace is missing, delayed, attached incorrectly, or missing child work. It helps answer four questions:
  1. Did this code path create a Lemma trace?
  2. Did the SDK send a payload to POST /traces/ingest?
  3. Did the ingest request succeed or fail?
  4. How many child spans did the SDK include?

Enable it

Enable debug mode before creating the Lemma client.
You can also enable it without code:
LEMMA_DEBUG=true is also accepted for backwards compatibility. After init, debug mode prints a one-time config banner:
If baseUrl is not production or projectId is not a valid UUID, the banner includes warnings. Verify logs and debugSmokeTest().ingestStatus reflect whether this specific trace was enqueued / ingested / ready — not whether the project has any ready traces.

Run a smoke test

Use debugSmokeTest() for a one-call delivery checklist you can paste into support:
The result includes config warnings, ingest HTTP status, response headers (cf-ray, server), and per-trace ingestStatus (enqueued / ingested / ready / not_found). You can also run one minimal trace manually from the same runtime that serves production traffic:
For a successful trace, look for this sequence:
sending trace now includes projectId, bodyBytes, and requestedAt. trace sent includes response headers (cf-ray, server, date) and warns when status !== 201. If the trace uses a handle, you should see trace handle created, then sending trace when the handle ends.

Verify ingest enqueue

After a successful 201, optionally poll the API to confirm this specific trace was enqueued (or already ingested/ready). This requires both debug mode and verify:
true is also accepted for both flags. With both enabled, the SDK calls GET /traces/ingest-status?project_id=...&otel_trace_id=... after ingest (polls immediately, then every 1s for up to 15s) and logs one of:
enqueued means the OTLP worker accepted the payload and wrote it to the ingest queue — it does not require the dashboard to show the trace yet (useful during backlog).

Confirming delivery reached Lemma

Support bundle to request from customers:
  • projectId, traceId, ingest url, HTTP status
  • Response headers (cf-ray, server, date)
  • Timestamp from requestedAt in the sending trace log

Read the logs

Use the first missing log line to narrow the problem.

Debug common issues

Missing traces

Start with the smoke test. If it logs trace sent, credentials and networking are working; move to the real request path and confirm that path also logs trace started. If it logs trace ingest failed, check:
  • LEMMA_API_KEY and LEMMA_PROJECT_ID are from the same project.
  • baseUrl / base_url points at a server that implements POST /traces/ingest.
  • Your runtime can make outbound HTTPS requests.
  • The hint field on trace ingest failed (401 → API key, 403 → project mismatch, 429 → rate limit, 404 → wrong host).

Missing tools or generations

Look at the spanCount (span_count in Python) in the sending trace log. If the count is lower than expected, the SDK never recorded those children. Common fixes:
  • Put recordTool() / recordGeneration() or record_tool() / record_generation() inside the lemma.trace() callback.
  • For work under a parent span, record it on the span handle in TypeScript or pass parent_id from the parent handle in Python before calling span.end(...).
  • For detached helpers, pass traceId and parentSpanId where needed.

Flat or incorrectly nested traces

If a parent span exists but its children appear as siblings, debug the order of calls:
The child call should happen before retrieve.end(...). In TypeScript, make it from the parent span handle. In Python, pass the parent handle’s id as parent_id when starting the child.

Serverless or streaming handlers

Debug mode should show trace sent before the function exits. If not, make sure the handler awaits the trace:
For trace handles, call and await trace.end(...) from the terminal callback or finalization path.