{"record":{"id":"096db875972a7b05","repo":"janhq/jan","slug":"backend-update-failed-result-reason","errorCode":null,"errorMessage":"Backend update failed: ${result.reason}","messagePattern":"Backend update failed: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"web-app/src/hooks/useBackendUpdater.ts","lineNumber":389,"sourceCode":"        syncStateToOtherInstances(newState)\n      } else if (\n        result?.wasUpdated === false &&\n        (result.reason === 'in_progress' || typeof result.reason === 'undefined')\n      ) {\n        // Benign no-op (e.g., another update is already in progress or the\n        // extension returned a no-op response without a reason). Do not treat\n        // this as a failure; just clear the local isUpdating flag.\n        setUpdateState((prev) => ({\n          ...prev,\n          isUpdating: false,\n        }))\n      } else if (\n        result?.wasUpdated === false &&\n        result.reason &&\n        result.reason !== 'in_progress'\n      ) {\n        // Explicit failure reason from extension: surface as an error.\n        throw new Error(`Backend update failed: ${result.reason}`)\n      } else {\n        throw new Error('Backend update failed')\n      }\n    } catch (error) {\n      console.error('Error updating backend:', error)\n      setUpdateState((prev) => ({\n        ...prev,\n        isUpdating: false,\n      }))\n      throw error\n    }\n  }, [updateState.updateInfo, updateState.isUpdating, syncStateToOtherInstances])\n\n  const installBackend = useCallback(async (filePath: string) => {\n    try {\n      // Get llamacpp extension instance\n      const allExtensions = ExtensionManager.getInstance().listExtensions()\n      const llamacppExtension =","sourceCodeStart":371,"sourceCodeEnd":407,"githubUrl":"https://github.com/janhq/jan/blob/fad3f12a147d138388a66f0d92a02b2675f65294/web-app/src/hooks/useBackendUpdater.ts#L371-L407","documentation":"Thrown when `extension.updateBackend(targetBackendString)` resolves with `{ wasUpdated: false, reason }` where `reason` is present and not the benign `'in_progress'`. The extension explicitly reported a failure (e.g. `'error'`, a download hash mismatch, disk-full, etc.), and the raw reason is surfaced.","triggerScenarios":"The backend download failed inside the extension: network error fetching the backend binary, checksum mismatch, insufficient disk space, the target version doesn't exist for the platform, or the extension's internal update routine threw and mapped it to `reason: 'error'`.","commonSituations":"Transient network outage during the backend download; GitHub/CDN hosting the binary is unreachable; disk full; proxy blocking the download URL; platform-unsupported backend variant.","solutions":["Check the extension's logs for the underlying `reason` value to identify network vs. disk vs. checksum.","Free disk space and retry; backends are several hundred MB.","If behind a proxy, ensure HTTPS egress to the backend CDN is allowed.","Retry — transient download failures often succeed on a second attempt."],"exampleFix":"// before\n} else if (result?.wasUpdated === false && result.reason && result.reason !== 'in_progress') {\n  throw new Error(`Backend update failed: ${result.reason}`)\n}\n\n// after\n} else if (result?.wasUpdated === false && result.reason && result.reason !== 'in_progress') {\n  const hint = /network|download|fetch/i.test(result.reason)\n    ? ' Check your connection and retry.'\n    : /space|disk|full/i.test(result.reason)\n      ? ' Free disk space and retry.'\n      : ''\n  throw new Error(`Backend update failed: ${result.reason}.${hint}`)\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":"function isFailedUpdateResult(r: unknown): r is { wasUpdated: false; reason: string } {\n  return !!r && (r as any).wasUpdated === false && typeof (r as any).reason === 'string' && (r as any).reason !== 'in_progress'\n}","tryCatchPattern":"try {\n  const result = await extension.updateBackend?.(targetBackendString) as BackendUpdateResult | undefined\n  if (isFailedUpdateResult(result)) {\n    toast.error('Backend update failed', { description: result.reason })\n    return\n  }\n} catch (error) {\n  console.error('updateBackend:', error)\n  throw error\n}","preventionTips":["Inspect the `reason` string to distinguish network/disk/checksum failures.","Retry once for transient network reasons.","Ensure adequate disk space (backends are hundreds of MB)."],"tags":["llamacpp","backend","update","download"],"backgroundTag":null,"analyzedSha":"fad3f12a147d138388a66f0d92a02b2675f65294","analyzedAt":"2026-08-12T20:33:47.516Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}