can1357/oh-my-pi · error · Error

Unknown tiny title model: ${key}

Error message

Unknown tiny title model: ${key}

What it means

getTinyTitleModelSpec looks up a title-model spec by key in the TINY_TITLE_LOCAL_MODELS table; the parameter is nominally a TinyTitleLocalModelKey, but a runtime value that isn't in the table throws rather than returning undefined. This guards against stale or hand-built keys reaching the spec loader.

Source

Thrown at packages/coding-agent/src/tiny/models.ts:107

		value: ONLINE_TINY_TITLE_MODEL_KEY,
		label: "Online (TINY role, else @smol)",
		description:
			"Online title generation: the TINY model role (set one in /models) when assigned, otherwise the online fallback (commit role, then @smol). No local download or on-device inference.",
	},
	...TINY_TITLE_LOCAL_MODELS.map(model => ({
		value: model.key,
		label: model.label,
		description: model.description,
	})),
] satisfies ReadonlyArray<{ value: TinyTitleModelKey; label: string; description: string }>;

export function isTinyTitleLocalModelKey(value: string): value is TinyTitleLocalModelKey {
	return TINY_TITLE_LOCAL_MODELS.some(model => model.key === value);
}

export function getTinyTitleModelSpec(key: TinyTitleLocalModelKey): (typeof TINY_TITLE_LOCAL_MODELS)[number] {
	const spec = TINY_TITLE_LOCAL_MODELS.find(model => model.key === key);
	if (!spec) throw new Error(`Unknown tiny title model: ${key}`);
	return spec;
}

/** Default memory model: the online path (the configured smol / remote LLM; no local download). */
export const ONLINE_MEMORY_MODEL_KEY = "online";
/** Recommended local model for memory tasks when none is named. */
export const DEFAULT_MEMORY_LOCAL_MODEL_KEY = "lfm2-1.2b";

/**
 * Local models for Mnemopi memory tasks (fact extraction + consolidation).
 * These are larger (1B-1.7B) than the title models: structured extraction and
 * faithful summarization need more capacity than 3-6 word titles. All q4.
 * Ranking/recipe rationale lives in docs/local-models.md.
 */
export const TINY_MEMORY_LOCAL_MODELS = [
	{
		key: "qwen3-1.7b",
		repo: "onnx-community/Qwen3-1.7B-ONNX",

View on GitHub (pinned to 9690622007)

Solutions

  1. Update the config to a currently bundled model key (check the tiny models list in docs/config)
  2. Validate with isTinyTitleLocalModelKey before calling getTinyTitleModelSpec
  3. Reset the tiny title model setting to the default

Example fix

// before
const key = savedConfig.titleModel; // "old-removed-model"
const spec = getTinyTitleModelSpec(key); // throws
// after
import { isTinyTitleLocalModelKey } from "./tiny/models";
if (isTinyTitleLocalModelKey(savedConfig.titleModel)) {
	const spec = getTinyTitleModelSpec(savedConfig.titleModel);
}
Defensive patterns

Strategy: type-guard

Validate before calling

import { TINY_TITLE_LOCAL_MODELS } from "./tiny/models";
const validKeys = TINY_TITLE_LOCAL_MODELS.map(m => m.key);
if (!validKeys.includes(key)) throw new Error(`Configured title model ${key} not bundled; pick one of ${validKeys.join(", ")}`);

Type guard

import { isTinyTitleLocalModelKey } from "./tiny/models";
function safeSpec(key: string) {
	return isTinyTitleLocalModelKey(key) ? getTinyTitleModelSpec(key) : null;
}

Try / catch

try {
	const spec = getTinyTitleModelSpec(key as never);
} catch (err) {
	if ((err as Error).message.startsWith("Unknown tiny title model")) {
		return DEFAULT_TITLE_MODEL_SPEC;
	}
	throw err;
}

Prevention

When it happens

Trigger: Calling getTinyTitleModelSpec with a key not present in TINY_TITLE_LOCAL_MODELS — e.g. from persisted config referencing a removed model, or bypassing isTinyTitleLocalModelKey's type narrowing.

Common situations: Upgrading omp where a bundled tiny title model was renamed/removed while an old config still names it; hand-editing `tiny.title.model` config values; passing raw user input without the type guard.

Related errors


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