{"record":{"id":"be0adc360e74cdb9","repo":"continuedev/continue","slug":"model-modelname-is-already-being-installed-be0adc","errorCode":null,"errorMessage":"Model '${modelName}' is already being installed.","messagePattern":"Model '(.+?)' is already being installed\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"core/llm/llms/Ollama.ts","lineNumber":773,"sourceCode":"      throw new Error(\"Ollama generated empty embedding\");\n    }\n    return embedding;\n  }\n\n  public async installModel(\n    modelName: string,\n    signal: AbortSignal,\n    progressReporter?: (task: string, increment: number, total: number) => void,\n  ): Promise<any> {\n    const modelInfo = await getRemoteModelInfo(modelName, signal);\n    if (!modelInfo) {\n      throw new Error(`'${modelName}' not found in the Ollama registry!`);\n    }\n\n    const release = await Ollama.modelsBeingInstalledMutex.acquire();\n    try {\n      if (Ollama.modelsBeingInstalled.has(modelName)) {\n        throw new Error(`Model '${modelName}' is already being installed.`);\n      }\n      Ollama.modelsBeingInstalled.add(modelName);\n    } finally {\n      release();\n    }\n\n    try {\n      const response = await fetch(this.getEndpoint(\"api/pull\"), {\n        method: \"POST\",\n        headers: {\n          \"Content-Type\": \"application/json\",\n          Authorization: `Bearer ${this.apiKey}`,\n        },\n        body: JSON.stringify({ name: modelName }),\n        signal,\n      });\n\n      const reader = response.body?.getReader();","sourceCodeStart":755,"sourceCodeEnd":791,"githubUrl":"https://github.com/continuedev/continue/blob/5522c6f44ca0ac3528b37244818fbfa39b5af470/core/llm/llms/Ollama.ts#L755-L791","documentation":"Thrown by Ollama.installModel under a mutex guarding concurrent installs: the model name is already in the static modelsBeingInstalled set, so a second install request for the same model is rejected instead of duplicating work.","triggerScenarios":"Two install requests for the same modelName racing — e.g. double-clicking install in the UI, or an autocomplete/indexing flow requesting the same model while a user-triggered install is in flight.","commonSituations":"UI double-submission, or a retry loop that fires before the first install completes (or fails without cleanup).","solutions":["Wait for the in-flight installation to finish and re-check installed models","If stuck (install crashed without cleanup), reload the extension window so the static set resets","Debounce/deduplicate install triggers in your code"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if (Ollama.modelsBeingInstalled.has(modelName)) {\n  log.info(`Install already in progress for ${modelName}; waiting`);\n  await waitForInstall(modelName);\n} else {\n  await Ollama.installModel(modelName, signal);\n}","typeGuard":"function isDuplicateInstall(e: unknown): boolean { return e instanceof Error && /already being installed/.test(e.message); }","tryCatchPattern":"try { await Ollama.installModel(name, signal); }\ncatch (e) { if (isDuplicateInstall(e)) return; /* idempotent success */ throw e; }","preventionTips":["Debounce install buttons in UI layers","Treat 'already being installed' as success/idempotent, not an error"],"tags":["ollama","model-install","concurrency","duplicate-request"],"backgroundTag":"duplicate-concurrent-operation","analyzedSha":"5522c6f44ca0ac3528b37244818fbfa39b5af470","analyzedAt":"2026-08-27T11:28:54.683Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}