janhq/jan · error
This provider cannot read model context limits. Update its…
Error message
This provider cannot read model context limits. Update its extension or check provider settings.
What it means
getModelContextLimit delegates to the provider's AI engine, but only if the engine implements the optional getModelContextLimit method; otherwise it throws. It tells the caller the provider/extension version cannot report context limits.
Solutions
- Update the provider extension to a version implementing getModelContextLimit
- Check provider name spelling so the correct engine resolves
- Catch the error and fall back to a default context length
- Check provider settings for manual context size configuration
Example fix
// before
const limit = await getModelContextLimit(modelId, provider)
// after
let limit: number | undefined
try { limit = await getModelContextLimit(modelId, provider) }
catch { limit = 4096 // fallback default } Defensive patterns
Strategy: fallback
Validate before calling
const engine = serviceHub.models().getEngine?.(provider) const supported = typeof engine?.getModelContextLimit === 'function'
Type guard
function supportsContextLimit(e: unknown): e is { getModelContextLimit: (id: string) => Promise<number|undefined> } { return typeof (e as any)?.getModelContextLimit === 'function' } Try / catch
try { limit = await getModelContextLimit(id, provider) } catch { limit = DEFAULT_CONTEXT_LENGTH } Prevention
- Keep provider extensions updated
- Feature-check optional engine methods before calling
- Document per-provider capability matrix
When it happens
Trigger: getModelContextLimit(modelId, provider) called for a provider whose engine lacks getModelContextLimit (older extension or engine that never implemented it).
Common situations: Using an outdated provider extension, a custom/community provider without context-limit support, or mistyping the provider name so the wrong engine resolves.
Related errors
- Catalog not supported for
- Failed to fetch models from
- model-errors:createModelFailed
- No API key configured for
- No model available to load
AI-assisted analysis of janhq/jan@7205d770c1 (2026-09-17).
Data as JSON: /api/errors/fe0f741154d4dd4e.
Report an issue: GitHub.
Appendix: source
Thrown at web-app/src/services/models/default.ts:52
// TODO: Replace this with the actual provider later
const defaultProvider = 'llamacpp'
export class DefaultModelsService implements ModelsService {
private getEngine(provider: string = defaultProvider) {
return EngineManager.instance().get(provider) as AIEngine | undefined
}
async getModel(modelId: string): Promise<modelInfo | undefined> {
return this.getEngine()?.get(modelId)
}
async getModelContextLimit(modelId: string, provider: string): Promise<number | undefined> {
const engine = this.getEngine(provider) as (AIEngine & {
getModelContextLimit?: (id: string) => Promise<number | undefined>
}) | undefined
if (!engine?.getModelContextLimit)
throw new Error('This provider cannot read model context limits. Update its extension or check provider settings.')
return engine.getModelContextLimit(modelId)
}
async fetchModels(): Promise<modelInfo[]> {
return this.getEngine()?.list() ?? []
}
async fetchModelCatalog(): Promise<ModelCatalog> {
try {
const response = await fetch(MODEL_CATALOG_URL)
if (!response.ok) {
throw new Error(
`Failed to fetch model catalog: ${response.status} ${response.statusText}`
)
}
const catalog: ModelCatalog = await response.json()View on GitHub (pinned to 7205d770c1)