{"record":{"id":"e124be419b7e0473","repo":"janhq/jan","slug":"backend-setup-was-not-successful-please-restart-t","errorCode":null,"errorMessage":"Backend setup was not successful. Please restart the app in a stable internet connection.","messagePattern":"Backend setup was not successful\\. Please restart the app in a stable internet connection\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"extensions/llamacpp-extension/src/index.ts","lineNumber":3999,"sourceCode":"    if (!touched) return\n\n    await invoke<void>('write_yaml', { data: cfg, savePath: configPath })\n\n    try {\n      await this.refreshRouterPreset()\n    } catch (e) {\n      logger.warn(\n        `Failed to restart router after model settings update for ${modelId}`,\n        e\n      )\n    }\n  }\n\n  async getDevices(): Promise<DeviceList[]> {\n    const cfg = this.config\n    const [version, backend] = cfg.version_backend.split('/')\n    if (!version || !backend) {\n      throw new Error(\n        'Backend setup was not successful. Please restart the app in a stable internet connection.'\n      )\n    }\n    // set envs\n    const envs: Record<string, string> = {}\n    if (this.llamacpp_env) this.parseEnvFromString(envs, this.llamacpp_env)\n\n    // Ensure backend is downloaded and ready before proceeding\n    await this.ensureBackendReady(backend, version)\n    logger.info('Calling Tauri command getDevices with arg --list-devices')\n    const backendPath = await getBackendExePath(backend, version)\n\n    try {\n      const dList = await invoke<DeviceList[]>('plugin:llamacpp|get_devices', {\n        backendPath,\n        envs,\n      })\n      // On Linux with AMD GPUs, llama.cpp via Vulkan may report UMA (shared) memory as device-local.","sourceCodeStart":3981,"sourceCodeEnd":4017,"githubUrl":"https://github.com/janhq/jan/blob/fad3f12a147d138388a66f0d92a02b2675f65294/extensions/llamacpp-extension/src/index.ts#L3981-L4017","documentation":"Thrown by getDevices() after splitting this.config.version_backend on '/'. The setting must be in the form '<version>/<backend>' (e.g. 'b4000/vulkan'). If either half is empty/falsy, the backend was never resolved, so device enumeration cannot proceed. The misleading 'stable internet connection' text points at the root cause: the backend download/selection step that populates version_backend failed or did not complete.","triggerScenarios":"Calling getDevices() during or before first-run backend setup; version_backend setting is empty, undefined, or malformed (no '/' separator, or trailing/leading slash). Also when the settings migration that writes version_backend has not run for this install.","commonSituations":"Fresh install where the backend manifest fetch failed (offline/corporate proxy); a settings reset that wiped version_backend; a downgrade/upgraded build whose default version_backend key changed; corrupted persisted settings.","solutions":["Ensure the app had network access on first launch so the backend manifest downloaded and version_backend was populated.","Restart the app so the setup/init flow re-runs and rewrites version_backend.","Open settings and confirm the llamacpp backend (and version) is selected; if blank, re-select it.","Check logs for the backend download/ensure step failing and resolve the underlying fetch error (proxy, disk space, permissions)."],"exampleFix":"// before\nconst devices = await engine.getDevices()\n\n// after\nconst [version, backend] = (engine.config.version_backend || '').split('/')\nif (!version || !backend) {\n  throw new Error('llamacpp backend not configured yet; finish first-run setup before listing devices')\n}\nconst devices = await engine.getDevices()","handlingStrategy":"validation","validationCode":"function isVersionBackendConfigured(vb: string | undefined): boolean {\n  if (!vb) return false\n  const [v, b] = vb.split('/')\n  return Boolean(v && b)\n}\n\nif (!isVersionBackendConfigured(engine.config.version_backend)) {\n  throw new Error('Finish first-run backend setup before listing devices')\n}","typeGuard":"function isVersionBackend(v: unknown): v is `${string}/${string}` {\n  return typeof v === 'string' && /^[^/]+\\/+[^/]+$/.test(v)\n}","tryCatchPattern":"try {\n  return await engine.getDevices()\n} catch (e) {\n  if (/Backend setup was not successful/.test(String(e))) {\n    await waitForBackendReady() // poll setup/init, then retry once\n    return await engine.getDevices()\n  }\n  throw e\n}","preventionTips":["Do not expose device selection until first-run setup completes.","Validate version_backend format before calling getDevices.","Surface backend download errors during setup so version_backend is never left blank."],"tags":["config","backend-setup","network","first-run","typescript"],"backgroundTag":null,"analyzedSha":"fad3f12a147d138388a66f0d92a02b2675f65294","analyzedAt":"2026-08-12T20:33:47.516Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}