{"record":{"id":"73ba1d3c86aba31d","repo":"earendil-works/pi","slug":"download-failed","errorCode":null,"errorMessage":"Download failed","messagePattern":"Download failed","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/extensions/llama/client.ts","lineNumber":314,"sourceCode":"\t\tlet failure: string | undefined;\n\t\tlet sawDownloading = false;\n\t\tlet polls = 0;\n\t\tvoid this.watch((event) => {\n\t\t\tif (event.model !== model) return;\n\t\t\tif (event.event === \"download_finished\") finished = true;\n\t\t\tif (event.event === \"download_failed\") failure = errorMessage(event.data, \"Download failed\");\n\t\t\tif (event.event === \"download_progress\") {\n\t\t\t\tsawDownloading = true;\n\t\t\t\tconst progress = parseDownloadProgress(event.data);\n\t\t\t\tif (progress) onProgress(progress);\n\t\t\t}\n\t\t}, watcher.signal).catch(() => {});\n\t\ttry {\n\t\t\tawait this.download(model, signal);\n\t\t\tonProgress({ message: \"Downloading model\" });\n\t\t\twhile (true) {\n\t\t\t\tif (signal?.aborted) throw signal.reason ?? new Error(\"Cancelled\");\n\t\t\t\tif (failure) throw new Error(failure);\n\t\t\t\tconst models = await this.list({ signal });\n\t\t\t\tpolls++;\n\t\t\t\tconst entry = models.find((candidate) => candidate.id === model);\n\t\t\t\tif (entry?.status.value === \"downloading\") {\n\t\t\t\t\tsawDownloading = true;\n\t\t\t\t\tconst progress = parseDownloadProgress(entry.status.progress);\n\t\t\t\t\tif (progress) onProgress(progress);\n\t\t\t\t} else if (finished || (entry && (sawDownloading || polls >= 2))) {\n\t\t\t\t\treturn this.list({ reload: true, signal });\n\t\t\t\t}\n\t\t\t\tawait sleep(500, signal);\n\t\t\t}\n\t\t} finally {\n\t\t\tunlink();\n\t\t\twatcher.abort();\n\t\t}\n\t}\n}","sourceCodeStart":296,"sourceCodeEnd":332,"githubUrl":"https://github.com/earendil-works/pi/blob/4af9d21d3b4d664e4a29fcabfec85171077248e3/packages/coding-agent/src/extensions/llama/client.ts#L296-L332","documentation":"Error \"Download failed\" thrown in earendil-works/pi.","triggerScenarios":"Thrown at packages/coding-agent/src/extensions/llama/client.ts:314 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"}