{"record":{"id":"64de20c42c305bc3","repo":"can1357/oh-my-pi","slug":"bundled-agent-agentname-for-vibe-cli-cli","errorCode":null,"errorMessage":"Bundled agent \"${agentName}\" for vibe cli \"${cli}\" is unavailable.","messagePattern":"Bundled agent \"(.+?)\" for vibe cli \"(.+?)\" is unavailable\\.","errorType":"exception","errorClass":"ToolError","httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/vibe/runtime.ts","lineNumber":398,"sourceCode":"\t\tconst key = scopeKey(scope, \"\");\n\t\tconst predecessor = this.#terminationTails.get(key) ?? Promise.resolve();\n\t\tconst released = Promise.withResolvers<void>();\n\t\tconst tail = predecessor.then(() => released.promise);\n\t\tthis.#terminationTails.set(key, tail);\n\t\tawait predecessor;\n\t\ttry {\n\t\t\treturn await operation();\n\t\t} finally {\n\t\t\treleased.resolve();\n\t\t\tif (this.#terminationTails.get(key) === tail) this.#terminationTails.delete(key);\n\t\t}\n\t}\n\n\t#resolveWorker(session: VibeParentSession, cli: VibeCli): ResolvedVibeWorker {\n\t\tconst agentName = VIBE_CLI_AGENT[cli];\n\t\tconst agent = getBundledAgent(agentName);\n\t\tif (!agent) {\n\t\t\tthrow new ToolError(`Bundled agent \"${agentName}\" for vibe cli \"${cli}\" is unavailable.`);\n\t\t}\n\t\tconst agentModelOverrides = session.settings.get(\"task.agentModelOverrides\");\n\t\t// Same contract as the task spawn path: the expansion discards the role\n\t\t// alias (`@task`, `@smol`), so patterns and role identity come from one\n\t\t// call — the child's inherited retry-fallback chain is keyed off the role.\n\t\tconst { patterns, role } = resolveAgentModelSelection({\n\t\t\tsettingsOverride: agentModelOverrides[agentName],\n\t\t\tagentModel: agent.model,\n\t\t\tsettings: session.settings,\n\t\t\tactiveModelPattern: session.getActiveModelString?.(),\n\t\t\tfallbackModelPattern: session.getModelString?.(),\n\t\t});\n\t\treturn { agent, modelOverride: patterns, modelRole: role };\n\t}\n\n\tasync #appendLifecycleEvent(\n\t\tsession: VibeParentSession,\n\t\tevent: VibeLifecycleEvent,","sourceCodeStart":380,"sourceCodeEnd":416,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/coding-agent/src/vibe/runtime.ts#L380-L416","documentation":"#resolveWorker maps a vibe CLI name to a bundled agent via VIBE_CLI_AGENT[cli] and getBundledAgent(agentName). If the bundled agent registry has no such agent, spawning cannot proceed, so it throws. This indicates the CLI→agent mapping or the bundled agent table is out of sync (e.g. a custom/trimmed build or stale registry).","triggerScenarios":"Calling vibe spawn (which calls #spawnLocked → #resolveWorker) with a cli whose mapped agent name is not present in the bundled agent registry — e.g. agents were not registered, a custom build pruned the agent, or the VIBE_CLI_AGENT table references a renamed agent.","commonSituations":"Custom builds that exclude bundled agents; version mismatch where the installed package renamed bundled agents; test harnesses that stub getBundledAgent; plugin/registration code that never registered the bundled agents.","solutions":["Verify getBundledAgent can resolve the mapped agent name for the cli; register bundled agents at startup if using a custom entrypoint.","Upgrade/repair the oh-my-pi installation so bundled agents match the VIBE_CLI_AGENT mapping.","Check whether test/initialization code cleared or replaced the bundled-agent registry."],"exampleFix":"// before\nawait spawn({ cli: \"fast\", prompt }); // agent never registered in custom build\n// after\nimport { registerBundledAgents } from \".../agents\";\nregisterBundledAgents();\nawait spawn({ cli: \"fast\", prompt });","handlingStrategy":"validation","validationCode":"import { getBundledAgent } from \".../agents\";\nconst agentName = VIBE_CLI_AGENT[cli];\nif (!getBundledAgent(agentName)) throw new Error(`Bundled agent \"${agentName}\" missing; register bundled agents before vibe spawn`);","typeGuard":"function cliResolvable(cli: VibeCli): boolean {\n  return !!getBundledAgent(VIBE_CLI_AGENT[cli]);\n}","tryCatchPattern":"try {\n  await vibe.spawn(session, { cli, prompt });\n} catch (err) {\n  if (err instanceof ToolError && /is unavailable/.test(err.message)) {\n    registerBundledAgents(); // then retry once\n  } else throw err;\n}","preventionTips":["Call agent registration at process startup in custom entrypoints","Keep VIBE_CLI_AGENT mappings in sync when renaming bundled agents","Smoke-test spawn for every supported cli in CI"],"tags":["configuration","build","agents"],"backgroundTag":"bundled-agent-unavailable","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}