tinyhumansai/openhuman · error · Error
empty transcript
Error message
empty transcript
What it means
readTranscript() in scripts/debug/agent-prepare-context-audit.mjs reads a session .jsonl transcript, splits on newlines, filters blank lines, and throws 'empty transcript' when zero lines remain. Session transcripts are written by the core as NDJSON (first line carries _meta, subsequent lines are messages); a file with no content at all means the core created the file but never flushed a line — or the audit is pointing at a file it should not be reading.
Source
Thrown at scripts/debug/agent-prepare-context-audit.mjs:319
entries.map(async (entry) => {
const full = path.join(current, entry.name);
if (entry.isDirectory()) return walk(full);
if (entry.isFile() && entry.name.endsWith(".jsonl")) out.push(full);
}),
);
}
await walk(dir);
return out;
}
function num(value) {
return Number.isFinite(Number(value)) ? Number(value) : 0;
}
async function readTranscript(file) {
const data = await readFile(file, "utf8");
const lines = data.split(/\r?\n/).filter((l) => l.trim());
if (lines.length === 0) throw new Error("empty transcript");
const meta = JSON.parse(lines[0])._meta || {};
const messages = [];
for (const line of lines.slice(1)) {
try {
const m = JSON.parse(line);
if (typeof m.role === "string") messages.push(m);
} catch {
// skip malformed line
}
}
return {
file,
agent: String(meta.agent || "(unknown)"),
threadId: meta.thread_id || null,
isSubagent: path.basename(file).includes("__"),
input: num(meta.input_tokens),
output: num(meta.output_tokens),
cached: num(meta.cached_input_tokens),View on GitHub (pinned to a221052e0d)
Solutions
- Re-run the audit — if the empty file was a crash artifact of a one-off failed turn, the fresh threads will be well-formed
- Inspect the empty file's path from the error to identify which thread died, and delete the orphaned zero-byte file
- Verify --workspace points at the workspace the audited core actually writes transcripts into
- If the core itself is crashing mid-turn, diagnose that first (its stderr / --verbose) — the empty transcript is a symptom, not the cause
Example fix
// before — the audit's walkJsonl sweeps every *.jsonl, including orphans Error: empty transcript // after — remove the orphaned file so the walk skips it $ find ~/.openhuman/users/<id>/workspace -name '*.jsonl' -size 0 -delete $ node scripts/debug/agent-prepare-context-audit.mjs
Defensive patterns
Strategy: validation
Validate before calling
import { statSync } from "node:fs";
function isReadableTranscript(file) {
const st = statSync(file);
return st.size > 0; // zero-byte NDJSON can never carry the _meta line
}
const files = (await walkJsonl(dir)).filter(isReadableTranscript); Type guard
async function isWellFormedTranscript(file) {
const data = await readFile(file, "utf8");
const lines = data.split(/\r?\n/).filter((l) => l.trim());
if (lines.length === 0) return false;
try { JSON.parse(lines[0]); return true; } catch { return false; }
} Try / catch
for (const f of transcriptFiles) {
try {
results.push(await readTranscript(f));
} catch (e) {
if (/^empty transcript$/.test(e.message)) { console.warn(`skipping orphaned empty transcript ${f}`); continue; }
throw e;
}
} Prevention
- Filter zero-byte *.jsonl files before analysis — they are crash residue, not data
- Scope the workspace: point --workspace at the workspace the audited core writes to, so stale files from other users/runs aren't swept
- Treat empty transcripts as a symptom: if they appear for threads the audit just ran, the core is dying mid-turn — debug that
When it happens
Trigger: The transcript walk (walkJsonl over the workspace's session directories) finds a .jsonl that is zero bytes or whitespace-only — typically a thread whose first turn crashed before the meta line was written, or a file created by a core that was killed mid-write. Reading the very-fresh transcript of a turn that hasn't committed its first line yet can also race this.
Common situations: Auditing a workspace that contains aborted/crashed prior sessions; a spawned core dying during the audited turn (its transcript stays empty) and the audit then sweeping it up; workspace pointed at the wrong user dir so unrelated stale files are scanned.
Related errors
- RPC envelope contains undefined data
- Core rejected the meet_agent_get_call_detail request.
- Cannot reveal "${path}" on this device — it is a path on the
- RPC token not found at ${tokenPath}. Pass --token or set OPE
- RPC token not provided and ${tokenPath} could not be read. P
AI-assisted analysis of tinyhumansai/openhuman@a221052e0d (2026-08-16).
Data as JSON: /api/errors/ba2b3ddcc018b8aa.
Report an issue: GitHub.