janhq/jan · error
Model does not exist
Error message
Model ${modelId} does not exist What it means
Thrown by the model-delete path when the models/<modelId>/model.yml file does not exist, meaning the extension has no record of this model under its provider directory. The extension refuses to delete rather than removing an unknown directory.
Solutions
- Verify the exact modelId via listModels / the app's model catalog before deleting.
- Check that models/<modelId>/model.yml exists under the llamacpp provider's data dir.
- If the directory is orphaned, remove it manually and refresh the model list.
- Re-import the model if the download/import was interrupted.
Example fix
// before
await deleteModel(modelId)
// after
const models = await extension.listModels()
if (!models.some(m => m.id === modelId)) {
console.warn(`Model ${modelId} not found; skipping delete`)
return
}
await deleteModel(modelId) Defensive patterns
Strategy: validation
Validate before calling
const catalog = await listModels()
if (!catalog.includes(modelId)) {
console.warn(`Skipping delete: ${modelId} is not registered with llamacpp provider`)
return
} Type guard
null
Try / catch
try {
await deleteModel(modelId)
} catch (e) {
if (String(e).includes('does not exist')) {
await refreshModelCatalog() // clear stale entry from UI
return // treat as already deleted
}
throw e
} Prevention
- Only pass model IDs obtained from listModels to deleteModel.
- Refresh the model catalog after external file changes.
- Never manually delete files under the provider's models/ directory; use the API.
- Distinguish 'already deleted' from real failures in your error handling.
When it happens
Trigger: Calling deleteModel(modelId) where models/<modelId>/model.yml is absent — wrong model ID, model imported by a different extension/provider, partial/corrupted import, or model already deleted.
Common situations: Stale UI cache listing models from another provider; user manually deleted files; modelId containing different casing or a provider prefix; import failed midway leaving a directory without model.yml.
Understand the failure class
Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.
Related errors
- Model does not exist
- model.yml not found for
- API request failed with status
- Backend update failed
- Backend update failed
AI-assisted analysis of janhq/jan@7205d770c1 (2026-09-17).
Data as JSON: /api/errors/d53078848ec99dc0.
Report an issue: GitHub.
Appendix: source
Thrown at extensions/llamacpp-extension/src/index.ts:2555
errorData
)}`
)
}
const completionResponse = (await response.json()) as chatCompletion
return completionResponse
}
override async delete(modelId: string): Promise<void> {
const modelDir = await joinPath([
await this.getProviderPath(),
'models',
modelId,
])
if (!(await fs.existsSync(await joinPath([modelDir, 'model.yml'])))) {
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)View on GitHub (pinned to 7205d770c1)