- Did this code path create a Lemma trace?
- Did the SDK send a payload to
POST /traces/ingest? - Did the ingest request succeed or fail?
- How many child spans did the SDK include?
Enable it
Enable debug mode before creating the Lemma client.- TypeScript
- Python
Run a smoke test
Run one minimal trace from the same runtime that serves production traffic:- TypeScript
- Python
trace handle created, then sending trace when the handle flushes or ends.
Read the logs
Use the first missing log line to narrow the problem.| What you see | What it means | What to check |
|---|---|---|
| No Lemma logs | Debug mode is not enabled in this process, or this code path is not running | Set LEMMA_DEBUG=true in the runtime that serves traffic |
trace started, but no sending trace | The callback did not finish, or the trace handle was never flushed/ended | Await lemma.trace(...), call trace.end(...), and check thrown errors |
sending trace, then trace ingest failed | The SDK reached the endpoint, but ingest rejected the request | Check status code, API key, project ID, baseUrl, and network policy |
trace sent, but the dashboard looks wrong | Delivery worked; the issue is likely trace shape | Compare spanCount (span_count in Python), tool/generation calls, and the trace contract |
Debug common issues
Missing traces
Start with the smoke test. If it logstrace 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_KEYandLEMMA_PROJECT_IDare from the same project.baseUrl/base_urlpoints at a server that implementsPOST /traces/ingest.- Your runtime can make outbound HTTPS requests.
Missing tools or generations
Look at thespanCount (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()orrecord_tool()/record_generation()inside thelemma.trace()callback. - For work under a parent span, record it on the span handle in TypeScript or pass
parent_idfrom the parent handle in Python before callingspan.end(...). - For detached helpers, pass
traceIdandparentSpanIdwhere needed.
Flat or incorrectly nested traces
If a parent span exists but its children appear as siblings, debug the order of calls:- TypeScript
- Python
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 showtrace sent before the function exits. If not, make sure the handler awaits the trace:
- TypeScript
- Python
trace.end(...) from the terminal callback or finalization path.