{"record":{"id":"c237031e38b1b33c","repo":"Yeachan-Heo/oh-my-codex","slug":"invalid-session-id-expected-1-128-alphanumeric-u","errorCode":null,"errorMessage":"Invalid session id. Expected 1-128 alphanumeric, underscore, or dash characters.","messagePattern":"Invalid session id\\. Expected 1-128 alphanumeric, underscore, or dash characters\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/imagegen/continuation.ts","lineNumber":66,"sourceCode":"}\n\nconst DEFAULT_ACTOR = \"omx-imagegen\";\nconst SESSION_ID_PATTERN = /^[A-Za-z0-9_-]{1,128}$/;\n\nfunction sessionImagegenPendingPath(cwd: string, sessionId: string): string {\n  return join(cwd, \".omx\", \"state\", \"sessions\", sessionId, \"imagegen-pending.json\");\n}\n\nfunction normalizeRequired(value: string | undefined, name: string): string {\n  const normalized = value?.trim() ?? \"\";\n  if (!normalized) throw new Error(`Missing required ${name}`);\n  return normalized;\n}\n\nfunction normalizeSessionId(sessionId: string): string {\n  const normalized = normalizeRequired(sessionId, \"session id\");\n  if (!SESSION_ID_PATTERN.test(normalized)) {\n    throw new Error(\"Invalid session id. Expected 1-128 alphanumeric, underscore, or dash characters.\");\n  }\n  return normalized;\n}\n\nfunction normalizeIsoOrNow(value: string | undefined, nowIso: string): string {\n  const normalized = value?.trim();\n  if (!normalized || normalized.toLowerCase() === \"now\") return nowIso;\n  const parsed = Date.parse(normalized);\n  if (!Number.isFinite(parsed)) {\n    throw new Error(`Invalid --after timestamp: ${value}`);\n  }\n  return new Date(parsed).toISOString();\n}\n\nfunction defaultResumeInstruction(\n  record: Omit<ImagegenContinuationRecord, \"resume_instruction\">,\n  pendingPath: string,\n): string {","sourceCodeStart":48,"sourceCodeEnd":84,"githubUrl":"https://github.com/Yeachan-Heo/oh-my-codex/blob/3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2/src/imagegen/continuation.ts#L48-L84","documentation":"The imagegen continuation CLI validates session ids against a pattern allowing 1-128 characters of letters, digits, underscores, and dashes. A session id containing other characters (spaces, slashes, dots, unicode) or exceeding 128 chars is rejected to keep session ids filesystem-safe.","triggerScenarios":"normalizeSessionId receives a session id failing SESSION_ID_PATTERN: empty, >128 chars, or containing characters outside [A-Za-z0-9_-].","commonSituations":"Passing a generated UUID with braces, a path-like id, a name with spaces, or a truncated/oversized generated identifier.","solutions":["Use only alphanumeric, underscore, and dash characters, max 128","Generate ids with a safe slug function in the calling code","URL-encode or slugify external identifiers before passing them as session ids"],"exampleFix":"// before\nomx imagegen continuation \"my session/2024\"\n// after\nomx imagegen continuation my-session-2024","handlingStrategy":"type-guard","validationCode":"const SESSION_ID_PATTERN = /^[A-Za-z0-9_-]{1,128}$/;\nif (!SESSION_ID_PATTERN.test(sessionId)) sessionId = sessionId.replace(/[^A-Za-z0-9_-]/g,'-').slice(0,128);","typeGuard":"function isValidSessionId(id: string): boolean { return /^[A-Za-z0-9_-]{1,128}$/.test(id); }","tryCatchPattern":null,"preventionTips":["Generate session ids from safe alphabets (slug/uuid-nodash)","Slugify external identifiers","Cap generated ids at 128 chars"],"tags":["cli","imagegen","session-id","validation"],"backgroundTag":"invalid-identifier-format","analyzedSha":"3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2","analyzedAt":"2026-08-27T22:18:39.783Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}