{"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":null,"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/7205d770c1e097c3daf35a911176410e93bc5564/web-app/src/services/hardware/tauri.ts#L5-L38","documentation":"getLlamacppDevices looks up the '@janhq/llamacpp-extension' via the extension manager and throws if it is not registered, because GPU device queries require that extension. It guards against calling getDevices() on undefined.","triggerScenarios":"getLlamacppDevices called when the llamacpp extension is not installed, not yet loaded, or was disabled/removed.","commonSituations":"Hardware settings page opened before extensions finish loading, extension failed to install, or llamacpp extension uninstalled while hardware service still references it.","solutions":["Ensure the @janhq/llamacpp-extension is installed and enabled","Wait for extension manager initialization before querying devices","Reinstall the llamacpp extension if it failed to load","Guard callers with extensionManager.getByName check first"],"exampleFix":"// before\nconst devices = await getLlamacppDevices()\n// after\nconst ext = window.core.extensionManager?.getByName('@janhq/llamacpp-extension')\nconst devices = ext ? await getLlamacppDevices() : []","handlingStrategy":"type-guard","validationCode":"const ext = window.core.extensionManager?.getByName('@janhq/llamacpp-extension')\nconst canQueryDevices = !!ext","typeGuard":"function hasLlamacpp(m: typeof window.core.extensionManager): boolean { return !!m?.getByName('@janhq/llamacpp-extension') }","tryCatchPattern":"try { const devices = await getLlamacppDevices() } catch { const devices = []; showExtensionWarning() }","preventionTips":["Gate hardware UI behind extension-manager ready signal","Verify llamacpp extension presence in startup diagnostics","Handle optional extensions gracefully in settings pages"],"tags":["extension","hardware","gpu"],"backgroundTag":"missing-dependency","analyzedSha":"7205d770c1e097c3daf35a911176410e93bc5564","analyzedAt":"2026-09-17T14:27:30.100Z","contentChangedAt":"2026-09-17T14:27:30.100Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}