janhq/jan · error · Error
model-errors:noRunningSession
model-errors:noRunningSession
Error message
model-errors:noRunningSession
What it means
Thrown by createLlamaCppModel when the Tauri invoke('plugin:llamacpp|find_session_by_model', { modelId }) returns null after the start phase. The model either was never started (provider was undefined so start was skipped) or started but no session registered for that modelId (model-factory.ts:935). Message is i18n key 'model-errors:noRunningSession'.
Source
Thrown at web-app/src/lib/model-factory.ts:935
console.error('Failed to start llamacpp model:', error)
// A serialized engine error is a plain object, so the previous
// `instanceof Error` path stringified it into raw JSON for the user.
throw new Error(
i18n.t('model-errors:startModelFailed', {
reason: describeEngineError(error),
})
)
}
}
// Get session info which includes port and api_key
const sessionInfo = await invoke<SessionInfo | null>(
'plugin:llamacpp|find_session_by_model',
{ modelId }
)
if (!sessionInfo) {
throw new Error(
i18n.t('model-errors:noRunningSession', { model: modelId })
)
}
const onLlamacppServerError = provider
? () => {
void (async () => {
try {
const { useServiceStore } = await import('@/hooks/useServiceHub')
const hub = useServiceStore.getState().serviceHub
await hub?.models().reloadModel(provider, modelId)
} catch (e) {
console.warn('[llamacpp] reload after crash failed:', e)
}
})()
}
: undefined
// The global toggle can strip reasoning_content from resent assistant turns,View on GitHub (pinned to fad3f12a14)
Solutions
- Ensure provider is passed into createLlamaCppModel so startModel actually runs.
- Avoid concurrent model swaps / page reloads during boot; let startModel settle before issuing inference.
- If reproducible, check the llama.cpp extension logs for a crashed or never-registered session.
- Verify the modelId used for find_session_by_model matches the one startModel registered (no prefix/suffix drift).
Example fix
// before
if (!sessionInfo) {
throw new Error(i18n.t('model-errors:noRunningSession', { model: modelId }))
}
// after: retry the lookup once after a short delay to absorb start/register race
if (!sessionInfo) {
await new Promise(r => setTimeout(r, 500))
const retried = await invoke<SessionInfo | null>('plugin:llamacpp|find_session_by_model', { modelId })
if (!retried) throw new Error(i18n.t('model-errors:noRunningSession', { model: modelId }))
return buildLlamaCppModel(modelId, retried, ...)
} Defensive patterns
Strategy: retry
Validate before calling
// ensure provider is passed so the start block runs
function assertProviderForLocal(provider: ProviderObject | undefined, modelId: string) {
if (!provider) throw new Error(`Cannot start ${modelId}: provider object is required to boot a local session`)
} Type guard
function isSessionInfo(x: unknown): x is SessionInfo {
return typeof x === 'object' && x !== null && typeof (x as SessionInfo).port === 'number'
} Try / catch
let sessionInfo = await invoke<SessionInfo | null>('plugin:llamacpp|find_session_by_model', { modelId })
if (!sessionInfo) {
// one bounded retry to absorb the start/register race
await new Promise(r => setTimeout(r, 500))
sessionInfo = await invoke<SessionInfo | null>('plugin:llamacpp|find_session_by_model', { modelId })
}
if (!sessionInfo) throw new Error(i18n.t('model-errors:noRunningSession', { model: modelId })) Prevention
- Always pass the provider object into createLlamaCppModel so startModel runs.
- Avoid page reloads and rapid model swaps during boot.
- Keep modelId identical between startModel and find_session_by_model (no prefix drift).
- Listen for KILL_SIDECAR and abort in-flight session lookups instead of letting them return null.
When it happens
Trigger: provider is falsy so the startModel block is skipped entirely; startModel resolved but the sidecar crashed between start and find_session_by_model; a different modelId string is used for the lookup than was used for start (id drift); the session table was cleared (KILL_SIDECAR event) mid-flight.
Common situations: Reloading the page or cancelling inference right as the model boots; switching models rapidly so the prior session is torn down; the sidecar was killed by a data-folder relocation or settings change; modelId includes a provider prefix in one call but not the other.
Related errors
- No running MLX session found for model: ${modelId}
- model-errors:startModelFailed
- llamacpp extension not found
- Failed to decompress archive: ${String(e)}
- ${String(e)}
AI-assisted analysis of janhq/jan@fad3f12a14 (2026-08-12).
Data as JSON: /api/errors/df18198f414f34cf.
Report an issue: GitHub.