earendil-works/pi · error · SessionError

invalid_entry

invalid_entry

Error message

Session id does not match header: ${metadata.id}

What it means

Error "Session id does not match header: ${metadata.id}" thrown in earendil-works/pi.

Source

Thrown at packages/agent/src/harness/session/jsonl/repo.ts:99

			const headerResult = parseHeader(firstLine);
			if (!headerResult.ok) continue;
			metadata.push(metadataFromHeader(headerResult.value, file.path, file.mtimeMs));
		}
	}
	return metadata.sort((left, right) => right.modifiedAt - left.modifiedAt);
}

export async function loadJsonlSessionStorage(
	options: JsonlSessionRepoOptions,
	metadata: JsonlSessionMetadata,
): Promise<JsonlSessionStorage> {
	if (!fileResult(await options.fs.exists(metadata.path), `Failed to check session ${metadata.path}`)) {
		throw new SessionError("not_found", `Session not found: ${metadata.id}`);
	}
	const storage = await JsonlSessionStorage.load(options.fs, metadata.path);
	const loadedMetadata = await storage.getMetadata();
	if (loadedMetadata.id !== metadata.id) {
		throw new SessionError("invalid_entry", `Session id does not match header: ${metadata.id}`);
	}
	return storage;
}

function sessionFileName(createdAt: number, id: string): string {
	const timestamp = new Date(createdAt).toISOString().replace(/[:.]/g, "-");
	return `${timestamp}_${id}.jsonl`;
}

export class JsonlSessionRepo
	implements SessionRepo<JsonlSessionMetadata, JsonlSessionCreateOptions, JsonlSessionListOptions>
{
	private readonly fs: JsonlSessionRepoFileSystem;
	private readonly sessionsRootInput: string;
	private readonly activeCreateDestinations = new Set<string>();
	private rootPromise: Promise<string> | undefined;

	constructor(options: JsonlSessionRepoOptions) {

View on GitHub (pinned to 4af9d21d3b)

Solutions

  1. Open the file that belongs to the requested session id so the id matches the file header.

When it happens

Trigger: Thrown at packages/agent/src/harness/session/jsonl/repo.ts:99 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of earendil-works/pi@4af9d21d3b (2026-08-24). Data as JSON: /api/errors/5633d0689f4cd3ca. Report an issue: GitHub.