{"record":{"id":"d1df9c4c16f3ecfb","repo":"earendil-works/pi","slug":"model-failed-to-load","errorCode":null,"errorMessage":"Model failed to load","messagePattern":"Model failed to load","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/extensions/llama/client.ts","lineNumber":274,"sourceCode":"\t\tvoid this.watch((event) => {\n\t\t\tif (event.model !== model) return;\n\t\t\tif (event.event !== \"model_status\" && event.event !== \"status_change\") return;\n\t\t\tconst data = event.data as { status?: unknown } | undefined;\n\t\t\tif (data?.status === \"loaded\") eventLoaded = true;\n\t\t\tif (data?.status === \"unloaded\") eventError = \"Model failed to load\";\n\t\t\tconst progress = parseLoadProgress(event.data);\n\t\t\tif (progress) onProgress(progress);\n\t\t}, watcher.signal).catch(() => {});\n\t\ttry {\n\t\t\tawait this.load(model, signal);\n\t\t\tonProgress({ message: \"Loading model\" });\n\t\t\twhile (true) {\n\t\t\t\tif (signal?.aborted) throw signal.reason ?? new Error(\"Cancelled\");\n\t\t\t\tconst entry = (await this.list({ signal })).find((candidate) => candidate.id === model);\n\t\t\t\tif (entry?.status.value === \"loaded\") return entry;\n\t\t\t\tif (eventLoaded && !entry) return { id: model, status: { value: \"loaded\" } };\n\t\t\t\tif (entry?.status.failed || eventError) {\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\tentry?.status.exit_code === undefined\n\t\t\t\t\t\t\t? (eventError ?? \"Model failed to load\")\n\t\t\t\t\t\t\t: `Model exited with code ${entry.status.exit_code}`,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tawait sleep(250, signal);\n\t\t\t}\n\t\t} finally {\n\t\t\tunlink();\n\t\t\twatcher.abort();\n\t\t}\n\t}\n\n\tasync downloadAndWait(\n\t\tmodel: string,\n\t\tonProgress: (progress: LlamaProgress) => void,\n\t\tsignal?: AbortSignal,\n\t): Promise<LlamaModelInfo[]> {","sourceCodeStart":256,"sourceCodeEnd":292,"githubUrl":"https://github.com/earendil-works/pi/blob/4af9d21d3b4d664e4a29fcabfec85171077248e3/packages/coding-agent/src/extensions/llama/client.ts#L256-L292","documentation":"Error \"Model failed to load\" thrown in earendil-works/pi.","triggerScenarios":"Thrown at packages/coding-agent/src/extensions/llama/client.ts:274 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"4af9d21d3b4d664e4a29fcabfec85171077248e3","analyzedAt":"2026-08-24T13:07:14.692Z","schemaVersion":2},"datasetVersion":"2026-08-24T17:17:21.512Z"}