janhq/jan · error
MLX model has crashed! Please reload!
Error message
MLX model has crashed! Please reload!
What it means
chat() first checks an isAlive flag for the MLX server session; if the session process is already known to be dead, it throws this error immediately without attempting the health fetch. The session is unusable and must be reloaded.
Solutions
- Reload the model to start a new MLX server session before retrying
- Check system logs (dmesg/journalctl) for OOM kills of the mlx server process
- Reduce model size or context length if the server is being OOM-killed
- Update the mlx extension/server if crashes are reproducible
Example fix
// before
const res = await chat(messages, model)
// after
let res
try {
res = await chat(messages, model)
} catch {
await model.reload()
res = await chat(messages, model)
} Defensive patterns
Strategy: try-catch
Validate before calling
if (!sessionInfo.isAlive) {
await reloadModel(model.id) // proactively reload before chat
} Type guard
const sessionUsable = (s) => Boolean(s && s.isAlive && s.port)
Try / catch
try {
return await chat(messages, model)
} catch (e) {
if (String(e.message).includes('has crashed')) {
await reloadModel(model.id)
return chat(messages, model)
}
throw e
} Prevention
- Wrap chat calls with a reload-and-retry helper
- Watch for child-process exit events to reload eagerly
- Check for OOM kills in system logs
- Keep conversation context bounded to reduce server memory pressure
When it happens
Trigger: Calling chat() when the MLX server subprocess tracked in sessionInfo has already exited (isAlive === false) — e.g. after a prior crash, manual kill, or abnormal termination.
Common situations: The model was unloaded by the OS OOM killer, the user killed the process, the app was suspended/resumed and the subprocess died, or a previous chat call unloaded the model on failure.
Related errors
- MLX model appears to have crashed! Please reload!
- No running MLX session found for model
- error.message
- IO error
- MLX API request failed with status
AI-assisted analysis of janhq/jan@7205d770c1 (2026-09-17).
Data as JSON: /api/errors/fc7402d6012dc2a2.
Report an issue: GitHub.
Appendix: source
Thrown at extensions/mlx-extension/src/index.ts:408
const sessionInfo = await this.findSessionByModel(opts.model)
if (!sessionInfo) {
throw new Error(`No active MLX session found for model: ${opts.model}`)
}
// Check if the process is alive
const isAlive = await invoke<boolean>('plugin:mlx|is_mlx_process_running', {
pid: sessionInfo.pid,
})
if (isAlive) {
try {
await fetch(`http://localhost:${sessionInfo.port}/health`)
} catch (e) {
this.unload(sessionInfo.model_id)
throw new Error('MLX model appears to have crashed! Please reload!')
}
} else {
throw new Error('MLX model has crashed! Please reload!')
}
const baseUrl = `http://localhost:${sessionInfo.port}/v1`
const url = `${baseUrl}/chat/completions`
const headers = {
'Content-Type': 'application/json',
'Authorization': `Bearer ${sessionInfo.api_key}`,
}
const body = JSON.stringify(opts)
if (opts.stream) {
return this.handleStreamingResponse(url, headers, body, abortController)
}
const response = await fetch(url, {
method: 'POST',
headers,View on GitHub (pinned to 7205d770c1)