different-ai/openwork · error
model_not_found
model_not_found
Error message
Model ${modelId} is not available for ${provider.name}. What it means
For models_dev providers, each requested modelId must exist in the provider's models.dev catalog entry. Unknown model IDs throw 404 model_not_found unless the provider is Azure (allowDeploymentIds), where arbitrary deployment names are accepted because Azure deployments mirror customer-named resources.
Source
Thrown at ee/apps/den-api/src/routes/org/llm-providers.ts:523
if (input.source === "models_dev") {
const provider = await getModelsDevProvider(input.providerId ?? "")
if (!provider) {
throw createFailure(404, "provider_not_found", "The selected provider was not found in models.dev.")
}
const requestedModelIds = [...new Set(input.modelIds ?? [])]
const modelsById = new Map(provider.models.map((model) => [model.id, model]))
// Azure model lists come from the resource's *deployments*, which admins
// can name anything — accept ids outside the models.dev catalog for
// Azure providers instead of rejecting the save.
const allowDeploymentIds = provider.npm === "@ai-sdk/azure"
const models = requestedModelIds.map((modelId) => {
const model = modelsById.get(modelId)
if (!model) {
if (allowDeploymentIds) {
return { id: modelId, name: modelId, config: { id: modelId, name: modelId } }
}
throw createFailure(404, "model_not_found", `Model ${modelId} is not available for ${provider.name}.`)
}
return model
})
return {
source: input.source,
providerId: provider.id,
name: input.name,
providerConfig: provider.config,
models: models.map((model) => ({
id: model.id,
name: model.name,
config: model.config,
})),
apiKey: resolveCredentialColumn({
providerConfig: provider.config,
existingProvider,
apiKey: input.apiKey,View on GitHub (pinned to 2b7df46e8a)
Solutions
- Fetch the provider's available models from the models.dev catalog (or the providers endpoint) and use exact catalog ids.
- Refresh the models.dev snapshot on the server if the model is new and legitimate.
- Use the Azure (deployment-based) source path if ids are customer-defined Azure deployment names.
- Remove invalid model ids from the request.
Example fix
// before modelIds: ["gpt-5-turbo"] // after modelIds: ["gpt-4o"] // exact id from models.dev catalog
Defensive patterns
Strategy: validation
Validate before calling
const provider = await getModelsDevProvider(providerId);
const validIds = new Set(provider.models.map(m => m.id));
if (!modelIds.every(id => validIds.has(id))) throw new Error('model id not in catalog for this provider'); Type guard
function isCatalogModel(id: string, models: {id: string}[]): boolean { return models.some(m => m.id === id) } Try / catch
try { await upsertProvider(payload) } catch (e) { if (e.code === 'model_not_found') await refreshCatalogAndRetry(); } Prevention
- List models from the provider's models.dev entry before referencing ids
- Refresh the models.dev snapshot when new models ship
- Do not copy model ids between different providers
- Use the Azure deployment path for customer-named deployment ids
When it happens
Trigger: An LLM provider request lists a modelIds entry that is not in the models.dev model list for that provider and the provider is not an Azure-style deployment provider.
Common situations: Requesting a model released after the server's models.dev snapshot was built; typos like 'gpt-4o-mini-2024-07-18' vs the catalog id; using OpenAI alias names not present in models.dev; copying model ids between providers.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
AI-assisted analysis of different-ai/openwork@2b7df46e8a (2026-09-01).
Data as JSON: /api/errors/35cafd7bef52e0f8.
Report an issue: GitHub.