vercel/ai · error

Invalid Deep Agents conversation checkpoint

Error message

Invalid Deep Agents conversation checkpoint

What it means

Within a v1 snapshot, every data line must be either an `S` record (checkpoint storage: 7 tab-separated fields) or a `W` record (pending writes: 6 fields), all values base64-encoded. Any line with an unexpected record type or wrong field count makes the snapshot invalid and the bridge throws instead of loading partial memory.

Source

Thrown at packages/harness-deepagents/src/bridge/persistent-memory-saver.ts:75

        decodeBytes(fields[4]),
        decodeBytes(fields[5]),
        fields[6] === '' ? undefined : decodeString(fields[6]),
      ];
      continue;
    }
    if (fields[0] === 'W' && fields.length === 6) {
      const [, keyValue, indexValue, taskIdValue, channelValue, value] = fields;
      const key = decodeString(keyValue);
      const index = decodeString(indexValue);
      writes[key] ??= Object.create(null);
      writes[key][index] = [
        decodeString(taskIdValue),
        decodeString(channelValue),
        decodeBytes(value),
      ];
      continue;
    }
    throw new Error('Invalid Deep Agents conversation checkpoint');
  }

  saver.storage = storage;
  saver.writes = writes;
}

export async function saveMemorySaver({
  path,
  saver,
}: {
  path: string;
  saver: MemorySaver;
}): Promise<void> {
  const lines = [SNAPSHOT_HEADER];

  for (const [threadId, namespaces] of Object.entries(saver.storage)) {
    for (const [namespace, checkpoints] of Object.entries(namespaces)) {
      for (const [

View on GitHub (pinned to 69428b1f8b)

Solutions

  1. Delete the corrupted `conversation.checkpoint` (`.agent-runs/<sessionId>/bridge/`) and start a new session — in-memory state cannot be partially trusted.
  2. Restore the checkpoint from a backup taken while the session was healthy.
  3. Check for tools (editors, sync clients) that may have re-encoded the file (e.g. changed tabs to spaces or line endings) and exclude it from them.
  4. Verify disk health / filesystem integrity if corruption recurs.

Example fix

// remove corrupted checkpoint
rm .agent-runs/<sessionId>/bridge/conversation.checkpoint
Defensive patterns

Strategy: fallback

Validate before calling

const lines = (await readFile(path, 'utf8').catch(() => '')).split('\n').filter(Boolean);
const ok = lines.slice(1).every(l => {
  const f = l.split('\t');
  return (f[0] === 'S' && f.length === 7) || (f[0] === 'W' && f.length === 6);
});

Try / catch

try {
  await resumeSession();
} catch (error) {
  if (error instanceof Error && error.message.includes('Invalid Deep Agents conversation checkpoint')) {
    // delete corrupted checkpoint and start a new session
  }
  throw error;
}

Prevention

When it happens

Trigger: Loading a `conversation.checkpoint` whose body contains a malformed line — corrupted bytes, a line with missing/extra tab-separated fields, non-base64 payloads breaking field counts, or manual edits to the file.

Common situations: Disk corruption or truncation of the checkpoint file; external tools (formatters, sync tools) rewriting the file and changing tabs/newlines; hand-merging snapshots; writing the file on a system that mangles encoding.

Related errors


AI-assisted analysis of vercel/ai@69428b1f8b (2026-08-30). Data as JSON: /api/errors/1775fbc85fd961e8. Report an issue: GitHub.