{"record":{"id":"ed54f464ffd7d108","repo":"slopus/happy","slug":"not-found","errorCode":"not_found","errorMessage":"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.","messagePattern":"Cannot resume Happy session \"(.+?)\" on this machine: no local session encryption data found at (.+?)\\. Start a new Happy session on this machine to enable future resumes\\.","errorType":"error_code","errorClass":"LocalResumeSessionError","httpStatus":null,"severity":"error","filePath":"packages/happy-cli/src/resume/localResumeStore.ts","lineNumber":82,"sourceCode":"    } catch (error) {\n        if (error instanceof AxiosError && error.response?.status === 401) {\n            throw new LocalResumeSessionError(\n                'Happy session lookup authentication expired. Run `happy auth login --force` in this environment.',\n                'unavailable',\n            );\n        }\n        return null;\n    }\n}\n\nexport 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);","sourceCodeStart":64,"sourceCodeEnd":100,"githubUrl":"https://github.com/slopus/happy/blob/b824cd0a4681d41af631a8e422a813873e4455b0/packages/happy-cli/src/resume/localResumeStore.ts#L64-L100","documentation":"resolveLocalReconnectableSession throws LocalResumeSessionError with code 'not_found' when readPersistedSessions() returns no records: the local sessions file (configuration.sessionsFile) contains no session encryption data at all. Local-only resume works exclusively from records in that file, so with zero records there is nothing to resume from.","triggerScenarios":"Running `happy resume <id>` on a machine whose sessions file is empty or missing entries — e.g. the file was deleted, HAPPY_ env vars/config point at a different sessionsFile than the one containing sessions, or resume is attempted on a fresh machine that never started a session locally.","commonSituations":"New laptop/container without prior Happy sessions; wiped config directory; pointing configuration at a non-default sessionsFile path by mistake; running as a different user whose HOME differs.","solutions":["Start a new Happy session on this machine to populate the sessions file, enabling future resumes","Verify configuration.sessionsFile points at the file that actually contains your sessions (check env/config overrides)","Copy/restore the sessions file from the machine where the session was created (with its encryption keys)","Check you are running as the same OS user that created the sessions"],"exampleFix":"// before (fresh machine)\nhappy resume abc123  // sessionsFile empty\n// after\nhappy  # start a session on this machine to seed sessionsFile\n# or restore the original sessions file, then\nhappy resume abc123","handlingStrategy":"validation","validationCode":"import { existsSync, readFileSync } from 'node:fs';\nconst sessionsFile = configuration.sessionsFile;\nif (!existsSync(sessionsFile)) {\n  console.error(`No sessions file at ${sessionsFile}; start a happy session first.`);\n  process.exit(1);\n}\nconst records = Object.keys(JSON.parse(readFileSync(sessionsFile, 'utf8')));\nif (records.length === 0) {\n  console.error('sessionsFile has no records; start a happy session on this machine.');\n  process.exit(1);\n}","typeGuard":null,"tryCatchPattern":"try {\n  await handleResumeCommand([sessionId]);\n} catch (e) {\n  if (e instanceof LocalResumeSessionError && e.code === 'not_found') {\n    console.error(e.message); // explains sessionsFile requirement\n    process.exit(1);\n  }\n  throw e;\n}","preventionTips":["Start at least one Happy session on each machine before expecting resume to work","Verify configuration.sessionsFile / env overrides point at the real sessions file","Back up the sessions file (it holds the encryption keys needed for resume)","Run resume as the same OS user that created the sessions"],"tags":["config","local-state","resume","not-found"],"backgroundTag":"missing-local-state","analyzedSha":"b824cd0a4681d41af631a8e422a813873e4455b0","analyzedAt":"2026-08-31T23:12:36.205Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}