{"record":{"id":"78d8cb0d32b7695e","repo":"janhq/jan","slug":"llamacpp-extension-not-found-78d8cb","errorCode":null,"errorMessage":"llamacpp extension not found","messagePattern":"llamacpp extension not found","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"web-app/src/services/hardware/tauri.ts","lineNumber":23,"sourceCode":"import { invoke } from '@tauri-apps/api/core'\nimport type { HardwareData, SystemUsage, DeviceList } from './types'\nimport { DefaultHardwareService } from './default'\n\nexport class TauriHardwareService extends DefaultHardwareService {\n  async getHardwareInfo(): Promise<HardwareData | null> {\n    return invoke('plugin:hardware|get_system_info') as Promise<HardwareData>\n  }\n\n  async getSystemUsage(): Promise<SystemUsage | null> {\n    return invoke('plugin:hardware|get_system_usage') as Promise<SystemUsage>\n  }\n\n  async getLlamacppDevices(): Promise<DeviceList[]> {\n    const extensionManager = window.core.extensionManager\n    const llamacppExtension = extensionManager.getByName('@janhq/llamacpp-extension')\n\n    if (!llamacppExtension) {\n      throw new Error('llamacpp extension not found')\n    }\n\n    return llamacppExtension.getDevices()\n  }\n\n  async setActiveGpus(data: { gpus: number[] }): Promise<void> {\n    // TODO: llama.cpp extension should handle this\n    console.log(data)\n  }\n\n  async refreshHardwareInfo(): Promise<void> {\n    await invoke('plugin:hardware|refresh_system_info')\n  }\n}\n","sourceCodeStart":5,"sourceCodeEnd":38,"githubUrl":"https://github.com/janhq/jan/blob/fad3f12a147d138388a66f0d92a02b2675f65294/web-app/src/services/hardware/tauri.ts#L5-L38","documentation":"Thrown by TauriHardwareService.getLlamacppDevices (hardware/tauri.ts:23) when window.core.extensionManager.getByName('@janhq/llamacpp-extension') returns a falsy value. The method needs the extension object to call getDevices() for GPU selection, so a missing extension aborts the device-list query.","triggerScenarios":"The llama.cpp extension is not installed, not registered with the extension manager, failed to load at startup, or window.core.extensionManager itself is undefined (running outside the Tauri desktop shell).","commonSituations":"Fresh install where the extension has not finished loading; the extension was disabled or uninstalled by the user; extension load failed due to a version mismatch or corrupted binary; running the code in a browser/web dev context with no core object.","solutions":["Install or enable the @janhq/llamacpp-extension from the Extensions settings.","Restart the app so the extension manager re-registers the extension on boot.","If the extension fails to load, check the logs for its init error and reinstall/update it.","Guard window.core?.extensionManager access so the call is not made in non-Tauri contexts."],"exampleFix":"// before\nconst llamacppExtension = extensionManager.getByName('@janhq/llamacpp-extension')\nif (!llamacppExtension) {\n  throw new Error('llamacpp extension not found')\n}\n// after: also handle missing extension manager, return empty device list\nif (!window.core?.extensionManager) return []\nconst ext = window.core.extensionManager.getByName('@janhq/llamacpp-extension')\nif (!ext) return []  // GPU picker simply shows no devices","handlingStrategy":"type-guard","validationCode":"function hasLlamacppExtension(): boolean {\n  const em = (window as any).core?.extensionManager\n  return Boolean(em && em.getByName('@janhq/llamacpp-extension'))\n}\n// before getLlamacppDevices:\nif (!hasLlamacppExtension()) return []","typeGuard":"function hasExtensionManager(w: unknown): w is { core: { extensionManager: { getByName(n: string): unknown } } } {\n  const c = (w as any).core\n  return Boolean(c && typeof c.extensionManager?.getByName === 'function')\n}","tryCatchPattern":"try {\n  return await hardwareService.getLlamacppDevices()\n} catch (e) {\n  if (e instanceof Error && e.message === 'llamacpp extension not found') return []\n  throw e\n}","preventionTips":["Check window.core?.extensionManager presence before calling getByName.","Re-register extensions on app boot and after install/uninstall.","Return an empty device list rather than throwing so the GPU picker degrades gracefully.","Surface a 'please restart' prompt when the extension is missing but expected."],"tags":["llamacpp","extension","hardware","gpu","tauri","typescript"],"backgroundTag":null,"analyzedSha":"fad3f12a147d138388a66f0d92a02b2675f65294","analyzedAt":"2026-08-12T20:33:47.516Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}