can1357/oh-my-pi · error
Unknown ACP model: ${modelId}
Error message
Unknown ACP model: ${modelId} What it means
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.
Source
Thrown at packages/coding-agent/src/modes/acp/acp-agent.ts:1810
})),
];
}
#getConfiguredThinkingLevel(session: AgentSession): string | undefined {
const configuredThinkingLevel = (session as { configuredThinkingLevel?: () => string | undefined })
.configuredThinkingLevel;
return typeof configuredThinkingLevel === "function"
? configuredThinkingLevel.call(session)
: session.thinkingLevel;
}
#toThinkingConfigValue(value: string | undefined): string {
return value && value !== "inherit" ? value : THINKING_OFF;
}
async #setModelById(session: AgentSession, modelId: string): Promise<void> {
const model = session.getAvailableModels().find(candidate => this.#toModelId(candidate) === modelId);
if (!model) {
throw new Error(`Unknown ACP model: ${modelId}`);
}
await session.setModel(model);
}
#setThinkingLevelById(session: AgentSession, value: string): void {
const thinkingLevel = parseConfiguredThinkingLevel(value);
if (!thinkingLevel) {
throw new Error(`Unknown ACP thinking level: ${value}`);
}
session.setThinkingLevel(thinkingLevel);
}
#toModelId(model: Model): string {
return `${model.provider}/${model.id}`;
}
#getAvailableModes(session: AgentSession): Array<{ id: string; name: string; description: string }> {
const modes = [{ id: ACP_DEFAULT_MODE_ID, name: "Default", description: "Standard ACP headless mode" }];View on GitHub (pinned to 9690622007)
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.
Example fix
// before
await agent.setModel(sessionId, { modelId: "claude-sonnet-4" });
// after
const models = await getAvailableModels(sessionId);
const id = models.find(m => m.id.includes("sonnet"))?.modelId;
if (!id) throw new Error("sonnet model unavailable");
await agent.setModel(sessionId, { modelId: id }); Defensive patterns
Strategy: validation
Validate before calling
const available = await getAvailableModels(sessionId);
if (!available.some(m => m.modelId === modelId)) {
throw new Error(`model ${modelId} not offered by this session; pick from: ${available.map(m => m.modelId).join(", ")}`);
} Try / catch
try {
await agent.setModel(sessionId, { modelId });
} catch (err) {
if (err.message.startsWith("Unknown ACP model:")) {
const fallback = (await getAvailableModels(sessionId))[0];
await agent.setModel(sessionId, { modelId: fallback.modelId });
} else throw err;
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- No tiny/smol model available for AI staging
- No model available for commit generation
- Plugin ${name} not found in runtime config
- Marketplace "${name}" not found
- Marketplace "${marketplace}" not found
AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31).
Data as JSON: /api/errors/126d2c13b9b30c23.
Report an issue: GitHub.