{"record":{"id":"df3a41bbdff40386","repo":"can1357/oh-my-pi","slug":"unknown-vibe-session-id-roster-length-0","errorCode":null,"errorMessage":"Unknown vibe session \"${id}\".${roster.length > 0 ? ` Active sessions: ${roster.join(\", \")}` : \" No sessions — spawn one with vibe_spawn.\"}","messagePattern":"Unknown vibe session \"(.+?)\"\\.(.+?)` : \" No sessions — spawn one with vibe_spawn\\.\"\\}","errorType":"exception","errorClass":"ToolError","httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/vibe/runtime.ts","lineNumber":542,"sourceCode":"\t\t\t}\n\t\t\tsessionManager.appendModeChange?.(\"none\");\n\t\t});\n\t\tfor (const record of pending) record.terminalPersisted = true;\n\t}\n\n\t#manager(session: ToolSession): AsyncJobManager {\n\t\tconst manager = session.asyncJobManager;\n\t\tif (!manager) {\n\t\t\tthrow new ToolError(\"Vibe sessions require async execution (no background job manager is available).\");\n\t\t}\n\t\treturn manager;\n\t}\n\n\t#record(scope: VibeOwnerScope, id: string): VibeRecord {\n\t\tconst record = this.#records.get(scopeKey(scope, id.trim()));\n\t\tif (!record || !matchesScope(record, scope)) {\n\t\t\tconst roster = this.#listIds(scope);\n\t\t\tthrow new ToolError(\n\t\t\t\t`Unknown vibe session \"${id}\".${roster.length > 0 ? ` Active sessions: ${roster.join(\", \")}` : \" No sessions — spawn one with vibe_spawn.\"}`,\n\t\t\t);\n\t\t}\n\t\treturn record;\n\t}\n\n\t#registeredAgent(record: VibeRecord): AgentRef | undefined {\n\t\tconst ref = AgentRegistry.global().get(record.id);\n\t\tif (ref?.kind !== \"sub\" || ref.parentId !== record.ownerId) return undefined;\n\t\tif (record.childSessionFile && ref.sessionFile !== record.childSessionFile) return undefined;\n\t\treturn ref;\n\t}\n\n\t#listIds(scope: VibeOwnerScope): string[] {\n\t\tconst ids: string[] = [];\n\t\tfor (const record of this.#records.values()) {\n\t\t\tif (matchesScope(record, scope) && record.state !== \"dead\") ids.push(record.id);\n\t\t}","sourceCodeStart":524,"sourceCodeEnd":560,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/coding-agent/src/vibe/runtime.ts#L524-L560","documentation":"#record looks up a vibe worker by scope key (owner + parent session + id). If no record exists or the record belongs to a different scope, it throws, appending the roster of active session ids in the current scope — or a hint to spawn one with vibe_spawn when none exist. This is a lookup failure: the requested id was never spawned in this scope, or has terminated.","triggerScenarios":"Calling vibe send/status/kill/watch (→ #record or watched) with an id that is not an active worker in the current owner scope: typo'd id, worker already exited and reaped, or the call issued from a different agent/session scope than the spawn.","commonSituations":"Referencing a worker after it finished and its record was rebuilt to terminal state under a different scope; stale id cached in agent memory after restart (records are rebuilt from persisted events and live jobs are process-local); calling from a subagent whose ownerId differs from the spawner.","solutions":["List active vibe sessions first and use an id from the roster.","Re-spawn with vibe_spawn if the session terminated or the process restarted.","Ensure the call runs in the same parent session and agent scope that spawned the worker (ownerId/parentSessionId must match)."],"exampleFix":"// before\nawait vibe.send(session, \"worker-7\", \"continue\"); // stale/unknown id\n// after\nconst { sessions } = await vibe.list(session);\nconst target = sessions.find(s => s.state === \"running\");\nif (target) await vibe.send(session, target.id, \"continue\");","handlingStrategy":"try-catch","validationCode":"const roster = await vibe.list(session);\nif (!roster.sessions.some(s => s.id === id)) {\n  throw new Error(`\"${id}\" is not an active vibe session; pick one of: ${roster.sessions.map(s => s.id).join(\", \")}`);\n}","typeGuard":null,"tryCatchPattern":"try {\n  await vibe.send(session, id, msg);\n} catch (err) {\n  if (err instanceof ToolError && err.message.startsWith(\"Unknown vibe session\")) {\n    const { sessions } = await vibe.list(session);\n    const target = sessions.find(s => s.state === \"running\");\n    if (target) await vibe.send(session, target.id, msg);\n  } else throw err;\n}","preventionTips":["Fetch ids from vibe list instead of caching them across restarts","Validate ids immediately after spawn (the spawn outcome id is authoritative)","Issue vibe calls from the same parent session and agent scope that spawned the worker"],"tags":["lookup","session","api-usage"],"backgroundTag":"unknown-session-id","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}