{"record":{"id":"e0f7c4a08c7a965f","repo":"slopus/happy","slug":"ambiguous-not-found","errorCode":"ambiguous|not_found","errorMessage":"${message}. Only sessions stored in ${configuration.sessionsFile} can be resumed without legacy account credentials.","messagePattern":"(.+?)\\. Only sessions stored in (.+?) can be resumed without legacy account credentials\\.","errorType":"error_code","errorClass":"LocalResumeSessionError","httpStatus":null,"severity":"error","filePath":"packages/happy-cli/src/resume/localResumeStore.ts","lineNumber":93,"sourceCode":"export async function resolveLocalReconnectableSession(sessionId: string): Promise<ReconnectableHappySession> {\n    const records = Object.entries(readPersistedSessions()).map(([id, session]) => ({\n        id,\n        ...session,\n    }));\n\n    if (records.length === 0) {\n        throw new LocalResumeSessionError(\n            `Cannot resume Happy session \"${sessionId}\" on this machine: no local session encryption data found at ${configuration.sessionsFile}. Start a new Happy session on this machine to enable future resumes.`,\n            'not_found',\n        );\n    }\n\n    let matched: PersistedSessionRecord;\n    try {\n        matched = resolveSessionRecordByPrefix(records, sessionId);\n    } catch (error) {\n        const message = error instanceof Error ? error.message : `No Happy session found matching \"${sessionId}\"`;\n        throw new LocalResumeSessionError(\n            `${message}. Only sessions stored in ${configuration.sessionsFile} can be resumed without legacy account credentials.`,\n            message.startsWith('Ambiguous') ? 'ambiguous' : 'not_found',\n        );\n    }\n\n    const encryptionKey = decodeBase64(matched.encryptionKey);\n    let metadata = parseResumableMetadata(matched.id, matched.metadata);\n    if (needsFreshMetadata(metadata)) {\n        metadata = await fetchServerMetadata(matched.id, encryptionKey, matched.encryptionVariant) ?? metadata;\n    }\n\n    return {\n        id: matched.id,\n        active: false,\n        metadata,\n        seq: matched.seq,\n        metadataVersion: matched.metadataVersion,\n        agentStateVersion: matched.agentStateVersion,","sourceCodeStart":75,"sourceCodeEnd":111,"githubUrl":"https://github.com/slopus/happy/blob/b824cd0a4681d41af631a8e422a813873e4455b0/packages/happy-cli/src/resume/localResumeStore.ts#L75-L111","documentation":"When resolveSessionRecordByPrefix throws (session not found by ID/prefix, or the prefix is ambiguous across multiple records), resolveLocalReconnectableSession re-wraps it as LocalResumeSessionError with code 'ambiguous' or 'not_found' and appends a note that only sessions in configuration.sessionsFile are resumable without legacy account credentials.","triggerScenarios":"Running `happy resume <id>` where the ID/prefix matches no record, or matches multiple records in the sessions file (resolveSessionRecordByPrefix raises 'Ambiguous...'), or the session exists server-side but was never persisted in the local sessions file.","commonSituations":"Typo'd or stale session ID; resuming a session created under a legacy account on another machine; a prefix that matches several sessions (e.g. 'abc' matching 'abc123' and 'abcd'); sessions file not synced to this machine.","solutions":["Re-run with a longer, exact session ID to disambiguate a prefix collision","Run `happy sessions` (or list persisted sessions) to copy the correct full ID","Verify the session was started on this machine and stored in configuration.sessionsFile; otherwise start/seed locally","Authenticate with legacy account credentials if the session predates local-only resume support"],"exampleFix":"// before\nhappy resume ab  // Ambiguous: matches abc123, abcd\n// after\nhappy resume abc123","handlingStrategy":"validation","validationCode":"const records = readPersistedSessions();\nconst matches = Object.keys(records).filter(id => id === sessionId || id.startsWith(sessionId));\nif (matches.length === 0) {\n  console.error(`No local session matching \"${sessionId}\"; run happy sessions to list IDs.`);\n  process.exit(1);\n}\nif (matches.length > 1) {\n  console.error(`Ambiguous prefix \"${sessionId}\" matches: ${matches.join(', ')}`);\n  process.exit(1);\n}","typeGuard":null,"tryCatchPattern":"try {\n  await handleResumeCommand([sessionId]);\n} catch (e) {\n  if (e instanceof LocalResumeSessionError && (e.code === 'ambiguous' || e.code === 'not_found')) {\n    console.error(e.message);\n    process.exit(1);\n  }\n  throw e;\n}","preventionTips":["Use the full session ID instead of a short prefix","List persisted sessions to copy exact IDs before resuming","Ensure sessions were started on this machine and stored in sessionsFile","Use legacy account credentials only for pre-local-store sessions"],"tags":["resume","lookup","ambiguity","not-found"],"backgroundTag":"ambiguous-identifier","analyzedSha":"b824cd0a4681d41af631a8e422a813873e4455b0","analyzedAt":"2026-08-31T23:12:36.205Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}