{"record":{"id":"126d2c13b9b30c23","repo":"can1357/oh-my-pi","slug":"unknown-acp-model-modelid","errorCode":null,"errorMessage":"Unknown ACP model: ${modelId}","messagePattern":"Unknown ACP model: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/modes/acp/acp-agent.ts","lineNumber":1810,"sourceCode":"\t\t\t})),\n\t\t];\n\t}\n\t#getConfiguredThinkingLevel(session: AgentSession): string | undefined {\n\t\tconst configuredThinkingLevel = (session as { configuredThinkingLevel?: () => string | undefined })\n\t\t\t.configuredThinkingLevel;\n\t\treturn typeof configuredThinkingLevel === \"function\"\n\t\t\t? configuredThinkingLevel.call(session)\n\t\t\t: session.thinkingLevel;\n\t}\n\n\t#toThinkingConfigValue(value: string | undefined): string {\n\t\treturn value && value !== \"inherit\" ? value : THINKING_OFF;\n\t}\n\n\tasync #setModelById(session: AgentSession, modelId: string): Promise<void> {\n\t\tconst model = session.getAvailableModels().find(candidate => this.#toModelId(candidate) === modelId);\n\t\tif (!model) {\n\t\t\tthrow new Error(`Unknown ACP model: ${modelId}`);\n\t\t}\n\t\tawait session.setModel(model);\n\t}\n\n\t#setThinkingLevelById(session: AgentSession, value: string): void {\n\t\tconst thinkingLevel = parseConfiguredThinkingLevel(value);\n\t\tif (!thinkingLevel) {\n\t\t\tthrow new Error(`Unknown ACP thinking level: ${value}`);\n\t\t}\n\t\tsession.setThinkingLevel(thinkingLevel);\n\t}\n\n\t#toModelId(model: Model): string {\n\t\treturn `${model.provider}/${model.id}`;\n\t}\n\n\t#getAvailableModes(session: AgentSession): Array<{ id: string; name: string; description: string }> {\n\t\tconst modes = [{ id: ACP_DEFAULT_MODE_ID, name: \"Default\", description: \"Standard ACP headless mode\" }];","sourceCodeStart":1792,"sourceCodeEnd":1828,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/coding-agent/src/modes/acp/acp-agent.ts#L1792-L1828","documentation":"Thrown by #setModelById (set_session_model) when the requested modelId does not match any model in the session's available-models list (compared via the agent's #toModelId normalization). Only models offered by the current session/provider configuration can be selected.","triggerScenarios":"A set_session_model request whose modelId is not among session.getAvailableModels() — e.g. wrong provider prefix, deprecated/renamed model id, or a model unavailable under the configured API keys.","commonSituations":"Client caches model ids from another session/provider; catalog updates renamed or removed a model; typo in provider/model slug (e.g. missing provider prefix); model excluded by the account's plan.","solutions":["List the session's available models and pick an exact id from that list (use the same #toModelId-style canonical form, provider/model).","Call session/list_modes or the equivalent models listing to refresh cached ids after upgrades.","If the model should exist, fix provider configuration/API keys so it appears in available models."],"exampleFix":"// before\nawait agent.setModel(sessionId, { modelId: \"claude-sonnet-4\" });\n// after\nconst models = await getAvailableModels(sessionId);\nconst id = models.find(m => m.id.includes(\"sonnet\"))?.modelId;\nif (!id) throw new Error(\"sonnet model unavailable\");\nawait agent.setModel(sessionId, { modelId: id });","handlingStrategy":"validation","validationCode":"const available = await getAvailableModels(sessionId);\nif (!available.some(m => m.modelId === modelId)) {\n  throw new Error(`model ${modelId} not offered by this session; pick from: ${available.map(m => m.modelId).join(\", \")}`);\n}","typeGuard":null,"tryCatchPattern":"try {\n  await agent.setModel(sessionId, { modelId });\n} catch (err) {\n  if (err.message.startsWith(\"Unknown ACP model:\")) {\n    const fallback = (await getAvailableModels(sessionId))[0];\n    await agent.setModel(sessionId, { modelId: fallback.modelId });\n  } else throw err;\n}","preventionTips":["Populate model pickers from the session's available-models list, never hard-coded ids.","Refresh cached model ids after catalog/provider upgrades.","Use the full canonical id (provider/model) when specifying models."],"tags":["acp","model-selection","not-found"],"backgroundTag":"unknown-model-id","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}