janhq/jan · error · Error

llamacpp extension not found

Error message

llamacpp extension not found

What it means

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.

Source

Thrown at web-app/src/services/hardware/tauri.ts:23

import { invoke } from '@tauri-apps/api/core'
import type { HardwareData, SystemUsage, DeviceList } from './types'
import { DefaultHardwareService } from './default'

export class TauriHardwareService extends DefaultHardwareService {
  async getHardwareInfo(): Promise<HardwareData | null> {
    return invoke('plugin:hardware|get_system_info') as Promise<HardwareData>
  }

  async getSystemUsage(): Promise<SystemUsage | null> {
    return invoke('plugin:hardware|get_system_usage') as Promise<SystemUsage>
  }

  async getLlamacppDevices(): Promise<DeviceList[]> {
    const extensionManager = window.core.extensionManager
    const llamacppExtension = extensionManager.getByName('@janhq/llamacpp-extension')

    if (!llamacppExtension) {
      throw new Error('llamacpp extension not found')
    }

    return llamacppExtension.getDevices()
  }

  async setActiveGpus(data: { gpus: number[] }): Promise<void> {
    // TODO: llama.cpp extension should handle this
    console.log(data)
  }

  async refreshHardwareInfo(): Promise<void> {
    await invoke('plugin:hardware|refresh_system_info')
  }
}

View on GitHub (pinned to fad3f12a14)

Solutions

  1. Install or enable the @janhq/llamacpp-extension from the Extensions settings.
  2. Restart the app so the extension manager re-registers the extension on boot.
  3. If the extension fails to load, check the logs for its init error and reinstall/update it.
  4. Guard window.core?.extensionManager access so the call is not made in non-Tauri contexts.

Example fix

// before
const llamacppExtension = extensionManager.getByName('@janhq/llamacpp-extension')
if (!llamacppExtension) {
  throw new Error('llamacpp extension not found')
}
// after: also handle missing extension manager, return empty device list
if (!window.core?.extensionManager) return []
const ext = window.core.extensionManager.getByName('@janhq/llamacpp-extension')
if (!ext) return []  // GPU picker simply shows no devices
Defensive patterns

Strategy: type-guard

Validate before calling

function hasLlamacppExtension(): boolean {
  const em = (window as any).core?.extensionManager
  return Boolean(em && em.getByName('@janhq/llamacpp-extension'))
}
// before getLlamacppDevices:
if (!hasLlamacppExtension()) return []

Type guard

function hasExtensionManager(w: unknown): w is { core: { extensionManager: { getByName(n: string): unknown } } } {
  const c = (w as any).core
  return Boolean(c && typeof c.extensionManager?.getByName === 'function')
}

Try / catch

try {
  return await hardwareService.getLlamacppDevices()
} catch (e) {
  if (e instanceof Error && e.message === 'llamacpp extension not found') return []
  throw e
}

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Related errors


AI-assisted analysis of janhq/jan@fad3f12a14 (2026-08-12). Data as JSON: /api/errors/78d8cb0d32b7695e. Report an issue: GitHub.