{"record":{"id":"4399182357ea1cdd","repo":"continuedev/continue","slug":"model-modelname-is-already-being-installed","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/Docker.ts","lineNumber":174,"sourceCode":"        .map((line) => line.trim())\n        .filter(Boolean);\n    } catch (error) {\n      console.error(\"Failed to list Docker models:\", error);\n      return Object.values(this.modelMap);\n    }\n  }\n\n  async installModel(\n    modelName: string,\n    signal: AbortSignal,\n    progressReporter?: (task: string, increment: number, total: number) => void,\n  ): Promise<any> {\n    const targetModel = this.modelMap[modelName] || modelName;\n\n    const release = await Docker.modelsBeingInstalledMutex.acquire();\n    try {\n      if (Docker.modelsBeingInstalled.has(modelName)) {\n        throw new Error(`Model '${modelName}' is already being installed.`);\n      }\n      Docker.modelsBeingInstalled.add(modelName);\n    } finally {\n      release();\n    }\n\n    try {\n      // Report starting the installation\n      progressReporter?.(`Installing Docker model ${targetModel}`, 0, 100);\n\n      // Pull the model\n      const { stdout, stderr } = await this.executeDockerCommand(\n        [\"model\", \"pull\", targetModel],\n        signal,\n      );\n\n      // Report completion\n      progressReporter?.(","sourceCodeStart":156,"sourceCodeEnd":192,"githubUrl":"https://github.com/continuedev/continue/blob/5522c6f44ca0ac3528b37244818fbfa39b5af470/core/llm/llms/Docker.ts#L156-L192","documentation":"Thrown by Docker.installModel when a model with the same name already has an in-flight installation tracked in the static Docker.modelsBeingInstalled set. It is a concurrency guard preventing duplicate simultaneous `docker model pull` operations, not an installation failure.","triggerScenarios":"Two code paths calling installModel(modelName) concurrently before the first finishes: parallel indexing/rerank workers installing the same embedding model, retries racing an in-progress install, or calling installModel inside a loop without awaiting dedupe.","commonSituations":"Multi-worker startup where each worker pre-installs models, concurrent HTTP handlers both triggering model install, or a frontend retry button racing the first install request.","solutions":["Treat this error as non-fatal: the model is already being installed; await completion and retry use","Dedupe installModel calls behind a shared per-model promise map","Initialize models once sequentially at startup before serving requests","If it persists after installs finish, check that finally-block cleanup isn't skipping (crashed install can leave a stale entry)"],"exampleFix":"// before\nawait Promise.all(models.map(m => docker.installModel(m)));\n// after\nconst pending = new Map();\nconst installOnce = (m) => pending.get(m) ??= docker.installModel(m).finally(() => pending.delete(m));\nawait Promise.all(models.map(installOnce));","handlingStrategy":"try-catch","validationCode":"const pending = new Map<string, Promise<unknown>>();\nfunction installOnce(docker: Docker, model: string) {\n  return pending.get(model) ??= docker.installModel(model).finally(() => pending.delete(model));\n}","typeGuard":"function isDuplicateInstallError(e: unknown): boolean {\n  return e instanceof Error && /already being installed/.test(e.message);\n}","tryCatchPattern":"try { await installOnce(docker, model); }\ncatch (e) {\n  if (isDuplicateInstallError(e)) { await waitForModelReady(docker, model); return; }\n  throw e;\n}","preventionTips":["Dedupe install calls behind a shared promise map","Treat 'already being installed' as success-pending, not failure","Initialize models sequentially at startup"],"tags":["docker","concurrency","model-install","mutex"],"backgroundTag":"duplicate-concurrent-operation","analyzedSha":"5522c6f44ca0ac3528b37244818fbfa39b5af470","analyzedAt":"2026-08-27T11:28:54.683Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}