{"record":{"id":"35cafd7bef52e0f8","repo":"different-ai/openwork","slug":"model-not-found","errorCode":"model_not_found","errorMessage":"Model ${modelId} is not available for ${provider.name}.","messagePattern":"Model (.+?) is not available for (.+?)\\.","errorType":"http","errorClass":null,"httpStatus":404,"severity":"error","filePath":"ee/apps/den-api/src/routes/org/llm-providers.ts","lineNumber":523,"sourceCode":"  if (input.source === \"models_dev\") {\n    const provider = await getModelsDevProvider(input.providerId ?? \"\")\n    if (!provider) {\n      throw createFailure(404, \"provider_not_found\", \"The selected provider was not found in models.dev.\")\n    }\n\n    const requestedModelIds = [...new Set(input.modelIds ?? [])]\n    const modelsById = new Map(provider.models.map((model) => [model.id, model]))\n    // Azure model lists come from the resource's *deployments*, which admins\n    // can name anything — accept ids outside the models.dev catalog for\n    // Azure providers instead of rejecting the save.\n    const allowDeploymentIds = provider.npm === \"@ai-sdk/azure\"\n    const models = requestedModelIds.map((modelId) => {\n      const model = modelsById.get(modelId)\n      if (!model) {\n        if (allowDeploymentIds) {\n          return { id: modelId, name: modelId, config: { id: modelId, name: modelId } }\n        }\n        throw createFailure(404, \"model_not_found\", `Model ${modelId} is not available for ${provider.name}.`)\n      }\n      return model\n    })\n\n    return {\n      source: input.source,\n      providerId: provider.id,\n      name: input.name,\n      providerConfig: provider.config,\n      models: models.map((model) => ({\n        id: model.id,\n        name: model.name,\n        config: model.config,\n      })),\n      apiKey: resolveCredentialColumn({\n        providerConfig: provider.config,\n        existingProvider,\n        apiKey: input.apiKey,","sourceCodeStart":505,"sourceCodeEnd":541,"githubUrl":"https://github.com/different-ai/openwork/blob/2b7df46e8ae1517d64c896c7793d2d52ec845669/ee/apps/den-api/src/routes/org/llm-providers.ts#L505-L541","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nmodelIds: [\"gpt-5-turbo\"]\n// after\nmodelIds: [\"gpt-4o\"] // exact id from models.dev catalog","handlingStrategy":"validation","validationCode":"const provider = await getModelsDevProvider(providerId);\nconst validIds = new Set(provider.models.map(m => m.id));\nif (!modelIds.every(id => validIds.has(id))) throw new Error('model id not in catalog for this provider');","typeGuard":"function isCatalogModel(id: string, models: {id: string}[]): boolean { return models.some(m => m.id === id) }","tryCatchPattern":"try { await upsertProvider(payload) } catch (e) { if (e.code === 'model_not_found') await refreshCatalogAndRetry(); }","preventionTips":["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"],"tags":["http-404","models-dev","model-catalog"],"backgroundTag":"resource-not-found","analyzedSha":"2b7df46e8ae1517d64c896c7793d2d52ec845669","analyzedAt":"2026-09-01T07:59:23.713Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}