{"record":{"id":"d9075ad8f296c585","repo":"can1357/oh-my-pi","slug":"unexpected-stop-unsupported-local-classifier-mode","errorCode":null,"errorMessage":"unexpected-stop: unsupported local classifier model: ${modelKey}","messagePattern":"unexpected-stop: unsupported local classifier model: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/session/unexpected-stop-classifier.ts","lineNumber":136,"sourceCode":"\n\tif (response.stopReason === \"error\") {\n\t\tthrow new Error(`unexpected-stop: online classification failed: ${response.errorMessage ?? \"unknown error\"}`);\n\t}\n\n\tconst outputText = response.content\n\t\t.filter((part): part is { type: \"text\"; text: string } => part.type === \"text\")\n\t\t.map(part => part.text)\n\t\t.join(\"\\n\");\n\treturn parseUnexpectedStopClassification(outputText);\n}\n\nasync function classifyLocal(\n\ttext: string,\n\tmodelKey: string,\n\tdeps: ClassifyUnexpectedStopDeps,\n): Promise<boolean | undefined> {\n\tif (!isTinyMemoryLocalModelKey(modelKey)) {\n\t\tthrow new Error(`unexpected-stop: unsupported local classifier model: ${modelKey}`);\n\t}\n\tconst builtPrompt = prompt.render(unexpectedStopClassifierPrompt, { message: text });\n\tconst output = await tinyModelClient.complete(modelKey, builtPrompt, {\n\t\tmaxTokens: ANSWER_MAX_TOKENS,\n\t\tsignal: deps.signal,\n\t});\n\tif (!output) {\n\t\treturn undefined;\n\t}\n\treturn parseUnexpectedStopClassification(output);\n}\n\nexport function parseUnexpectedStopClassification(text: string): boolean | undefined {\n\tconst trimmed = text.trim().toLowerCase();\n\tif (trimmed.startsWith(\"yes\")) return true;\n\tif (trimmed.startsWith(\"no\")) return false;\n\treturn undefined;\n}","sourceCodeStart":118,"sourceCodeEnd":154,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/coding-agent/src/session/unexpected-stop-classifier.ts#L118-L154","documentation":"classifyLocal only supports classifier models identified by isTinyMemoryLocalModelKey (the local 'tiny memory' model family). Any other modelKey string is rejected with this error before a prompt is built. It guards the tinyModelClient.complete contract.","triggerScenarios":"Calling the local classification path with a model key that is not a recognized tiny-memory local model key: a remote model id, a typo'd local model name, or a local model not present in the supported set.","commonSituations":"Settings/config points the local classifier at an unsupported local model; version change renamed or dropped a tiny-memory model key; caller accidentally passes a provider/model id instead of the local key format.","solutions":["Use one of the supported tiny-memory local model keys (check isTinyMemoryLocalModelKey / tinyModelClient docs).","Correct the model key in the settings/config that selected it.","Install/download the supported local model if it is missing locally.","Route remote models to classifyOnline instead of the local path."],"exampleFix":"// before\nawait classifyLocal(text, \"llama-3.2-1b\", deps); // unsupported key\n// after\nawait classifyLocal(text, \"tiny-memory-default\", deps); // key accepted by isTinyMemoryLocalModelKey","handlingStrategy":"validation","validationCode":"if (!isTinyMemoryLocalModelKey(modelKey)) {\n  throw new Error(`Configure a supported local classifier model, got: ${modelKey}`);\n}\n","typeGuard":"function isSupportedLocalKey(k: string): k is TinyMemoryLocalModelKey {\n  return isTinyMemoryLocalModelKey(k);\n}","tryCatchPattern":"try {\n  verdict = await classifyUnexpectedStop(text, deps);\n} catch (err) {\n  if (err instanceof Error && err.message.startsWith(\"unexpected-stop: unsupported local classifier model\")) {\n    verdict = undefined; // or route to online classification\n  } else throw err;\n}","preventionTips":["Only pass keys produced by the tiny-memory model catalog to the local path.","Validate configured local model keys at startup against isTinyMemoryLocalModelKey.","Update config when the local model key set changes between versions.","Route non-local models to classifyOnline instead."],"tags":["validation","local-model","classification"],"backgroundTag":"unsupported-model","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}