Most Mortem issues fall into a small set of root causes: a misconfigured API key, a missing verify token on the first run, or agent code that bypassesDocumentation Index
Fetch the complete documentation index at: https://docs.mortemlabs.com/llms.txt
Use this file to discover all available pages before exploring further.
session.run(). Work through the relevant section below to isolate the problem. If none of these resolve your issue, rotate your API key from the agent settings page and re-run the onboarding wizard.
No traces appearing in the dashboard
No traces appearing in the dashboard
Traces are missing when the SDK cannot authenticate with the ingest service or cannot reach it at all.Check the following in order:
-
API key — confirm
MORTEM_API_KEYin your agent environment matches exactly what the dashboard shows under agent settings. The key is only displayed once during onboarding; if you lost it, rotate it and use the new one. -
Agent ID — confirm
MORTEM_AGENT_IDis set and matches the ID shown in the dashboard for this agent. Without a valid agent ID, the ingest service has no agent to attach the trace to. -
Verify token on first run — if this is the first time you are running the agent,
MORTEM_VERIFY_TOKENmust be present in the environment. The token tells the ingest service to associate your first trace with the agent and mark it as verified. See the verify token section below for details. -
Ingest URL — confirm
MORTEM_INGEST_URLis set correctly. In local development it should behttp://localhost:4001. For the hosted service the SDK defaults tohttps://ingest.mortem.dev— you only need to setMORTEM_INGEST_URLif you want to override that default. -
Flush before exit — always call
await mortem.close()at the end of your agent process. Without it, buffered events may not flush before the process exits.
Ingest rejects SDK batches (401 or 403)
Ingest rejects SDK batches (401 or 403)
A
401 or 403 from the ingest service means the API key did not match any agent on record, or the key was present but the batch was rejected for another auth reason.- Wrong key — confirm the key was copied directly from the dashboard without any extra whitespace or line breaks. Keys are case-sensitive.
- Key not yet saved — if you just created the agent, wait a few seconds and retry. The key is cached in Redis after the first lookup.
-
Missing verify token on first run — if this is the agent’s first batch,
MORTEM_VERIFY_TOKENmust be included in the same run. Without it the ingest service cannot confirm agent ownership and rejects the batch. -
Stale key after rotation — if you rotated the API key in the dashboard, update
MORTEM_API_KEYin your agent environment and redeploy before retrying.
Analysis never appears on a trace
Analysis never appears on a trace
Analysis is computed asynchronously after the trace finishes. It does not appear while the agent is still running.Check the following:
-
Trace status — open the trace detail page and confirm the status shows
completedorerrored, notrunning. Analysis does not start until the trace is closed. Callawait session.complete()orawait session.fail(error)to close the trace explicitly, or usesession.run()which closes the session automatically. - Wait a few minutes — analysis is asynchronous and may take 1–3 minutes after the trace completes, depending on trace size and LLM provider latency.
- Rerun analysis — if the trace is marked completed but analysis still does not appear after several minutes, use the Rerun analysis button on the trace detail page to re-queue it.
Live stream shows nothing
Live stream shows nothing
The live stream on the agent detail page only shows traces that are currently running. If the agent has already finished its run, the stream is empty by design.
- Confirm the agent is actively running — start a new run and watch the stream. Events appear in real time as the SDK flushes its buffer (every 250 ms by default).
- Check the agent ID — confirm the dashboard is showing the live stream for the correct agent. The agent ID in your environment must match the agent whose detail page you are viewing.
-
Confirm
session.run()is in use — child events such as LLM calls and tool calls only appear on the live stream when they are emitted inside asession.run()context. See the missing events section below.
Verify token issues
Verify token issues
The verify token is a one-time credential that proves you control an agent on the first run. It is only valid once and expires after successful verification.
-
Send it on the first run — include
MORTEM_VERIFY_TOKENin your agent environment the first time you run the agent after creating it in the dashboard. The onboarding wizard polls until it sees the token. -
Remove it after verification — once the wizard shows the agent as verified, delete
MORTEM_VERIFY_TOKENfrom your.envfile and any deployment secrets. Leaving it in place does not cause errors, but it is unnecessary and exposes a credential that is no longer usable. -
Re-verify an unverified agent — if the dashboard still shows the agent as unverified after the first run, add
MORTEM_VERIFY_TOKENback temporarily and run the agent once more. The token can be resent if verification did not complete the first time.
SDK events missing from trace
SDK events missing from trace
If your trace appears in the dashboard but child events — LLM calls, tool calls, Solana transactions — are missing, the most likely cause is that those calls were made outside of a If you need to create events manually outside of
session.run() context.The SDK uses Node.js async local storage to track which session is active. Calls made outside session.run() do not have access to that context, so auto-captured events from wrappers are silently dropped.Always wrap your agent work in session.run():session.run(), call session.beginEvent() directly — those events are always recorded regardless of async context.To rotate a compromised or lost API key, open the agent’s settings page in the dashboard and click Rotate API key. The new key is shown once — copy it immediately and update your agent environment before restarting.