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
- Check the logged original error (logger.error output) — the rethrown message 'e' is not informative.
- Ensure the llamacpp engine/provider is started before calling getLoadedModels.
- Restart the engine process if it crashed and retry.
- 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
- Start the llamacpp engine/provider before querying loaded models.
- Retry with backoff — engine startup races produce this frequently.
- Inspect logs for the real error since the rethrown message is uninformative ('e').
- Patch the wrapper to rethrow e instanceof Error ? e : new Error(String(e)).
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)