can1357/oh-my-pi · error

Agent has no transcript: session is gone and no session…

Error message

Agent ${ref.id} has no transcript: session is gone and no session file was retained

What it means

An agent id is known (it appears in the agent registry) but has no retrievable transcript: the live session is gone and no session file path was retained, and the disk scan found nothing. resolve throws rather than returning an empty history.

Solutions

  1. Accept the transcript is unrecoverable and query a different agent/session
  2. Check the artifacts directory manually for orphaned session files
  3. Enable/disable retention settings so future sessions persist their session file
Defensive patterns

Strategy: try-catch

Try / catch

try {
  return await resolve(`history://${agentId}`)
} catch (err) {
  if (String(err).includes('has no transcript')) {
    logger.warn('transcript unrecoverable', { agentId })
    return null
  }
  throw err
}

Prevention

When it happens

Trigger: history://<agentId> for an agent whose session ended without sessionFile retention (e.g. aborted before first persist, or session file deleted) and #resolveFromDisk found no retained file under any artifacts dir.

Common situations: Requesting history for an agent that crashed very early; sessions cleaned by retention policy; running across machines where the artifacts dir differs.

Related errors


AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31). Data as JSON: /api/errors/65f76354429dd07f. Report an issue: GitHub.

Appendix: source

Thrown at packages/coding-agent/src/internal-urls/history-protocol.ts:120

			const known = visible.map(candidate => candidate.id);
			const knownStr = known.length > 0 ? known.join(", ") : "none";
			throw new Error(`Unknown agent: ${agentId}\nKnown agents: ${knownStr}\nList all with history://`);
		}

		const notes: string[] = [];
		let messages: unknown[];
		if (ref.session) {
			messages = ref.session.messages;
			notes.push("Source: live session");
		} else if (ref.sessionFile) {
			messages = await loadSessionMessagesReadOnly(ref.sessionFile);
			notes.push(`Source: session file (read-only, ${ref.status})`);
		} else {
			// No live session and no retained sessionFile — try the disk scan before
			// giving up, in case the transcript lingers under an artifacts dir.
			const disk = await this.#resolveFromDisk(ref.id, preferredArtifactDir);
			if (disk) return { ...disk, url: url.href };
			throw new Error(`Agent ${ref.id} has no transcript: session is gone and no session file was retained`);
		}

		const content = formatSessionHistoryMarkdown(messages, { title: `${ref.id} (${ref.status})` });
		return {
			url: url.href,
			content,
			contentType: "text/markdown",
			size: Buffer.byteLength(content, "utf-8"),
			sourcePath: ref.sessionFile ?? undefined,
			notes,
		};
	}

	/**
	 * Load a transcript for `agentId` from an on-disk `.jsonl` session file,
	 * matched case-insensitively. Returns `undefined` when no file is found.
	 * `preferredArtifactDir` — the caller root's artifact directory, when
	 * known — is scanned before every registry-derived dir, so a same-id

View on GitHub (pinned to 9690622007)