janhq/jan · warning

e

Error message

e

What it means

getLoadedModels catches any failure from pluginGetLoadedModels (querying the engine's loaded-model list), logs it, and rethrows it wrapped as new Error(e). Passing a non-string to the Error constructor produces 'e' as the message when e is an Error object, making the rethrown error nearly useless to callers.

Solutions

  1. Check the logged original error (logger.error output) — the rethrown message 'e' is not informative.
  2. Ensure the llamacpp engine/provider is started before calling getLoadedModels.
  3. Restart the engine process if it crashed and retry.
  4. Fix the wrapper to preserve the original message: use new Error(e instanceof Error ? e.message : String(e)).

Example fix

// before
} catch (e) {
  logger.error(e)
  throw new Error(e)
}
// after
} catch (e) {
  logger.error(e)
  throw new Error(`getLoadedModels failed: ${e instanceof Error ? e.message : String(e)}`)
}
Defensive patterns

Strategy: try-catch

Validate before calling

null

Type guard

function isWrappedPluginError(e: unknown): boolean {
  return e instanceof Error && e.message === 'e'
}

Try / catch

let loaded: string[] = []
try {
  loaded = await getLoadedModels()
} catch {
  // engine may not be running yet; fall back to empty list and retry later
  loaded = []
}

Prevention

When it happens

Trigger: pluginGetLoadedModels rejects — engine subprocess not running/IPC failure, engine returning malformed data, or any internal plugin error while enumerating loaded models.

Common situations: llamacpp engine not started yet when the UI queries loaded models; engine crashed during a previous inference; IPC/tauri invoke failure between extension and engine.

Understand the failure class

Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.

Related errors


AI-assisted analysis of janhq/jan@7205d770c1 (2026-09-17). Data as JSON: /api/errors/90bf6216175a872c. Report an issue: GitHub.

Appendix: source

Thrown at extensions/llamacpp-extension/src/index.ts:2573

      throw new Error(`Model ${modelId} does not exist`)
    }

    await fs.rm(modelDir)

    try {
      await this.refreshEnginePreset()
    } catch (e) {
      logger.warn(`Router refresh after delete(${modelId}) failed:`, e)
    }
  }

  override async getLoadedModels(): Promise<string[]> {
    try {
      let models: string[] = await pluginGetLoadedModels()
      return models
    } catch (e) {
      logger.error(e)
      throw new Error(e)
    }
  }

  /**
   * Check if mmproj.gguf file exists for a given model ID
   * @param modelId - The model ID to check for mmproj.gguf
   * @returns Promise<boolean> - true if mmproj.gguf exists, false otherwise
   */
  async checkMmprojExists(modelId: string): Promise<boolean> {
    try {
      const modelConfigPath = await joinPath([
        await this.getProviderPath(),
        'models',
        modelId,
        'model.yml',
      ])

      const modelConfig = await invoke<ModelConfig>('read_yaml', {

View on GitHub (pinned to 7205d770c1)