earendil-works/pi · error · SessionError
invalid_payload
invalid_payload
Error message
Session id must be non-empty, contain only alphanumeric characters, '-', '_', and '.', and start and end with an alphanumeric character
What it means
Error "Session id must be non-empty, contain only alphanumeric characters, '-', '_', and '.', and start and end with an alphanumeric character" thrown in earendil-works/pi.
Source
Thrown at packages/agent/src/harness/session/jsonl/repo.ts:20
import { assertJsonSerializable, Session } from "../session.ts";
import { type ForkOptions, SessionError, type SessionRepo } from "../types.ts";
import { metadataFromHeader, parseHeader } from "./codec.ts";
import { fileResult } from "./errors.ts";
import { JsonlSessionStorage } from "./storage.ts";
import type {
JsonlSessionCreateOptions,
JsonlSessionListOptions,
JsonlSessionMetadata,
JsonlSessionRepoFileSystem,
JsonlSessionRepoOptions,
JsonlV4Header,
} from "./types.ts";
const SESSION_ID_PATTERN = /^[A-Za-z0-9](?:[A-Za-z0-9._-]*[A-Za-z0-9])?$/;
function validateSessionId(id: string): void {
if (!SESSION_ID_PATTERN.test(id)) {
throw new SessionError(
"invalid_payload",
"Session id must be non-empty, contain only alphanumeric characters, '-', '_', and '.', and start and end with an alphanumeric character",
);
}
}
function jsonlSessionDirectoryName(cwd: string): string {
return `--${cwd.replace(/^[/\\]/, "").replace(/[/\\:]/g, "-")}--`;
}
async function jsonlSessionsRoot(options: JsonlSessionRepoOptions): Promise<string> {
return fileResult(
await options.fs.absolutePath(options.sessionsRoot),
`Failed to resolve sessions root ${options.sessionsRoot}`,
);
}
async function jsonlSessionDirectory(View on GitHub (pinned to 4af9d21d3b)
Solutions
- Use a session id that starts and ends with an alphanumeric character and contains only alphanumerics, dash, underscore, and dot.
When it happens
Trigger: Thrown at packages/agent/src/harness/session/jsonl/repo.ts:20 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/dda28c7c566d880e.
Report an issue: GitHub.