{"record":{"id":"b5ee583c31a083ba","repo":"can1357/oh-my-pi","slug":"unknown-acp-thinking-level-value","errorCode":null,"errorMessage":"Unknown ACP thinking level: ${value}","messagePattern":"Unknown ACP thinking level: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/modes/acp/acp-agent.ts","lineNumber":1818,"sourceCode":"\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\" }];\n\t\tif (session.settings.get(\"plan.enabled\")) {\n\t\t\tmodes.push({\n\t\t\t\tid: ACP_PLAN_MODE_ID,\n\t\t\t\tname: \"Plan\",\n\t\t\t\tdescription: \"Read-only planning mode that drafts a plan to a markdown file before any code changes\",\n\t\t\t});\n\t\t}\n\t\tvoid session;","sourceCodeStart":1800,"sourceCodeEnd":1836,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/coding-agent/src/modes/acp/acp-agent.ts#L1800-L1836","documentation":"AcpAgent.#setThinkingLevelById validates an incoming ACP session/thinking-level value through parseConfiguredThinkingLevel before applying it to the session. When the string does not map to any configured thinking level, the agent refuses to set it and throws this error so the ACP client learns the request was rejected. It exists to keep unknown or misspelled level identifiers from silently degrading or corrupting session state.","triggerScenarios":"Calling the ACP session set-mode / thinking-level RPC (#setThinkingLevelById) with a value string that parseConfiguredThinkingLevel returns null for — e.g. an alias or numeric string the config layer does not recognize.","commonSituations":"An ACP client (editor plugin) sends a thinking level name from a newer or older spec version; a user hand-edits agent config with a typo like 'hight' or 'max'; a client forwards a raw model-native level name ('high') where only configured aliases are accepted.","solutions":["Check the value against the configured thinking levels accepted by parseConfiguredThinkingLevel (packages/coding-agent config/thinking-level module) and use exactly one of those strings.","Update the client/ACP adapter to map its native level names onto the configured level identifiers before calling the session API.","If the level should be supported, add it to the configured thinking-level aliases so parseConfiguredThinkingLevel resolves it."],"exampleFix":"// before\nawait agent.setThinkingLevel(\"ultrathink\");\n// after\nawait agent.setThinkingLevel(\"high\"); // a level parseConfiguredThinkingLevel recognizes","handlingStrategy":"validation","validationCode":"const VALID_LEVELS = new Set([\"off\", \"minimal\", \"low\", \"medium\", \"high\", \"max\"]);\nif (!VALID_LEVELS.has(level)) throw new Error(`Unsupported thinking level: ${level}`);\nawait agent.setThinkingLevel(level);","typeGuard":null,"tryCatchPattern":"try {\n  await agent.setThinkingLevel(value);\n} catch (err) {\n  if (err.message.startsWith(\"Unknown ACP thinking level\")) {\n    logger.warn(\"falling back to default level\", { value });\n    await agent.setThinkingLevel(\"medium\");\n  } else throw err;\n}","preventionTips":["Discover the accepted level ids from the agent/config surface instead of hardcoding names.","Map client-native level names to configured aliases in one place in your adapter.","Log unknown values with their source so config typos surface quickly."],"tags":["acp","config","thinking-level"],"backgroundTag":"invalid-enum-value","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}