{"record":{"id":"379840add1c3fb8a","repo":"can1357/oh-my-pi","slug":"unknown-tiny-title-model-key","errorCode":null,"errorMessage":"Unknown tiny title model: ${key}","messagePattern":"Unknown tiny title model: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/tiny/models.ts","lineNumber":107,"sourceCode":"\t\tvalue: ONLINE_TINY_TITLE_MODEL_KEY,\n\t\tlabel: \"Online (TINY role, else @smol)\",\n\t\tdescription:\n\t\t\t\"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.\",\n\t},\n\t...TINY_TITLE_LOCAL_MODELS.map(model => ({\n\t\tvalue: model.key,\n\t\tlabel: model.label,\n\t\tdescription: model.description,\n\t})),\n] satisfies ReadonlyArray<{ value: TinyTitleModelKey; label: string; description: string }>;\n\nexport function isTinyTitleLocalModelKey(value: string): value is TinyTitleLocalModelKey {\n\treturn TINY_TITLE_LOCAL_MODELS.some(model => model.key === value);\n}\n\nexport function getTinyTitleModelSpec(key: TinyTitleLocalModelKey): (typeof TINY_TITLE_LOCAL_MODELS)[number] {\n\tconst spec = TINY_TITLE_LOCAL_MODELS.find(model => model.key === key);\n\tif (!spec) throw new Error(`Unknown tiny title model: ${key}`);\n\treturn spec;\n}\n\n/** Default memory model: the online path (the configured smol / remote LLM; no local download). */\nexport const ONLINE_MEMORY_MODEL_KEY = \"online\";\n/** Recommended local model for memory tasks when none is named. */\nexport const DEFAULT_MEMORY_LOCAL_MODEL_KEY = \"lfm2-1.2b\";\n\n/**\n * Local models for Mnemopi memory tasks (fact extraction + consolidation).\n * These are larger (1B-1.7B) than the title models: structured extraction and\n * faithful summarization need more capacity than 3-6 word titles. All q4.\n * Ranking/recipe rationale lives in docs/local-models.md.\n */\nexport const TINY_MEMORY_LOCAL_MODELS = [\n\t{\n\t\tkey: \"qwen3-1.7b\",\n\t\trepo: \"onnx-community/Qwen3-1.7B-ONNX\",","sourceCodeStart":89,"sourceCodeEnd":125,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/coding-agent/src/tiny/models.ts#L89-L125","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Update the config to a currently bundled model key (check the tiny models list in docs/config)","Validate with isTinyTitleLocalModelKey before calling getTinyTitleModelSpec","Reset the tiny title model setting to the default"],"exampleFix":"// before\nconst key = savedConfig.titleModel; // \"old-removed-model\"\nconst spec = getTinyTitleModelSpec(key); // throws\n// after\nimport { isTinyTitleLocalModelKey } from \"./tiny/models\";\nif (isTinyTitleLocalModelKey(savedConfig.titleModel)) {\n\tconst spec = getTinyTitleModelSpec(savedConfig.titleModel);\n}","handlingStrategy":"type-guard","validationCode":"import { TINY_TITLE_LOCAL_MODELS } from \"./tiny/models\";\nconst validKeys = TINY_TITLE_LOCAL_MODELS.map(m => m.key);\nif (!validKeys.includes(key)) throw new Error(`Configured title model ${key} not bundled; pick one of ${validKeys.join(\", \")}`);","typeGuard":"import { isTinyTitleLocalModelKey } from \"./tiny/models\";\nfunction safeSpec(key: string) {\n\treturn isTinyTitleLocalModelKey(key) ? getTinyTitleModelSpec(key) : null;\n}","tryCatchPattern":"try {\n\tconst spec = getTinyTitleModelSpec(key as never);\n} catch (err) {\n\tif ((err as Error).message.startsWith(\"Unknown tiny title model\")) {\n\t\treturn DEFAULT_TITLE_MODEL_SPEC;\n\t}\n\tthrow err;\n}","preventionTips":["Always pass keys through isTinyTitleLocalModelKey before lookup","After upgrades, re-validate persisted tiny model keys against the bundled list","Prefer named export constants (ONLINE/default keys) over hard-coded strings in config"],"tags":["tiny-model","configuration","lookup"],"backgroundTag":"unknown-model-key","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}