janhq/jan · error
Provider must have base_url configured
Error message
Provider must have base_url configured
What it means
A validation guard thrown at the top of fetchModelsFromProvider in the Tauri provider service. The method expects the given ModelProvider to expose a base_url so it can issue an HTTP request to the provider's OpenAI-compatible endpoint to list models; when provider.base_url is empty or undefined it cannot construct the request and throws this sentinel error instead. It fires for built-in or runtime providers configured without a base URL (e.g., local-only providers with no endpoint), and callers of fetchModelsFromProvider are expected to catch it and surface the configuration problem to the user.
Solutions
- Set the base_url field on the provider (e.g. https://api.openai.com/v1)
- Re-add the provider with a complete configuration
- Validate base_url before calling fetchModelsFromProvider
- Reset the provider to its default settings
Example fix
// before
const models = await fetchModelsFromProvider(provider)
// after
if (!provider.base_url) throw new Error('Configure base_url before fetching models')
const models = await fetchModelsFromProvider(provider) Defensive patterns
Strategy: validation
Validate before calling
if (!provider.base_url) throw new Error('Provider missing base_url') Type guard
function hasBaseUrl(p: ModelProvider): p is ModelProvider & { base_url: string } { return typeof p.base_url === 'string' && p.base_url.length > 0 } Try / catch
try { models = await fetchModelsFromProvider(provider) } catch (e) { if (String(e).includes('base_url')) openProviderSettings(provider); else throw e } Prevention
- Require base_url when creating provider entries
- Validate provider configs on import
- Mark providers without base_url as incomplete in the UI
When it happens
Trigger: fetchModelsFromProvider called with a ModelProvider object whose base_url is undefined/empty — e.g. a provider entry created without an endpoint.
Common situations: Manually added provider missing base_url, provider config imported incompletely, or built-in provider whose base_url was cleared in settings.
Understand the failure class
Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.
Related errors
- Provider configuration is required
- Provider must have base_url configured
- Catalog not supported for
- No API key configured for
- ubatch_size ( ) is too small. Minimum required
AI-assisted analysis of janhq/jan@7205d770c1 (2026-09-17).
Data as JSON: /api/errors/1d16bbafeea33f04.
Report an issue: GitHub.
Appendix: source
Thrown at web-app/src/services/providers/tauri.ts:149
return runtimeProviders.concat(builtinProviders as ModelProvider[])
} catch (error: unknown) {
console.error('Error getting providers in Tauri:', error)
return []
}
}
async deleteProviderKeys(providerName: string): Promise<void> {
try {
await invoke('delete_provider_keys', { provider: providerName })
} catch (error) {
console.error(`Failed to delete keyring keys for ${providerName}:`, error)
}
}
async fetchModelsFromProvider(provider: ModelProvider): Promise<string[]> {
if (!provider.base_url) {
throw new Error('Provider must have base_url configured')
}
try {
const keyChain = providerRemoteApiKeyChain(provider)
const keyAttempts: (string | undefined)[] =
keyChain.length > 0 ? keyChain : [undefined]
let lastStatus = 0
let lastStatusText = ''
for (let ki = 0; ki < keyAttempts.length; ki++) {
const key = keyAttempts[ki]
const headers: Record<string, string> = {
'Content-Type': 'application/json',
}
if (
provider.base_url.includes('localhost:') ||View on GitHub (pinned to 7205d770c1)