can1357/oh-my-pi · error

unexpected-stop: unsupported local classifier model: ${model

Error message

unexpected-stop: unsupported local classifier model: ${modelKey}

What it means

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.

Source

Thrown at packages/coding-agent/src/session/unexpected-stop-classifier.ts:136

	if (response.stopReason === "error") {
		throw new Error(`unexpected-stop: online classification failed: ${response.errorMessage ?? "unknown error"}`);
	}

	const outputText = response.content
		.filter((part): part is { type: "text"; text: string } => part.type === "text")
		.map(part => part.text)
		.join("\n");
	return parseUnexpectedStopClassification(outputText);
}

async function classifyLocal(
	text: string,
	modelKey: string,
	deps: ClassifyUnexpectedStopDeps,
): Promise<boolean | undefined> {
	if (!isTinyMemoryLocalModelKey(modelKey)) {
		throw new Error(`unexpected-stop: unsupported local classifier model: ${modelKey}`);
	}
	const builtPrompt = prompt.render(unexpectedStopClassifierPrompt, { message: text });
	const output = await tinyModelClient.complete(modelKey, builtPrompt, {
		maxTokens: ANSWER_MAX_TOKENS,
		signal: deps.signal,
	});
	if (!output) {
		return undefined;
	}
	return parseUnexpectedStopClassification(output);
}

export function parseUnexpectedStopClassification(text: string): boolean | undefined {
	const trimmed = text.trim().toLowerCase();
	if (trimmed.startsWith("yes")) return true;
	if (trimmed.startsWith("no")) return false;
	return undefined;
}

View on GitHub (pinned to 9690622007)

Solutions

  1. Use one of the supported tiny-memory local model keys (check isTinyMemoryLocalModelKey / tinyModelClient docs).
  2. Correct the model key in the settings/config that selected it.
  3. Install/download the supported local model if it is missing locally.
  4. Route remote models to classifyOnline instead of the local path.

Example fix

// before
await classifyLocal(text, "llama-3.2-1b", deps); // unsupported key
// after
await classifyLocal(text, "tiny-memory-default", deps); // key accepted by isTinyMemoryLocalModelKey
Defensive patterns

Strategy: validation

Validate before calling

if (!isTinyMemoryLocalModelKey(modelKey)) {
  throw new Error(`Configure a supported local classifier model, got: ${modelKey}`);
}

Type guard

function isSupportedLocalKey(k: string): k is TinyMemoryLocalModelKey {
  return isTinyMemoryLocalModelKey(k);
}

Try / catch

try {
  verdict = await classifyUnexpectedStop(text, deps);
} catch (err) {
  if (err instanceof Error && err.message.startsWith("unexpected-stop: unsupported local classifier model")) {
    verdict = undefined; // or route to online classification
  } else throw err;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31). Data as JSON: /api/errors/d9075ad8f296c585. Report an issue: GitHub.