{"record":{"id":"645bef9717cae4d6","repo":"mastra-ai/mastra","slug":"no-enabled-models-available-for-execution","errorCode":null,"errorMessage":"No enabled models available for execution","messagePattern":"No enabled models available for execution","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"critical","filePath":"packages/core/src/agent/durable/workflows/steps/llm-execution.ts","lineNumber":301,"sourceCode":"      // 2. Determine if we have a model list for fallback support\n      const hasModelList = typedInput.modelList && typedInput.modelList.length > 0;\n\n      // 3. Build the model list - either from explicit list or single model\n      // For single model case (no modelList), we use the resolved model directly\n      // which supports mock models and directly-provided models\n      const modelList = hasModelList\n        ? typedInput.modelList!.filter(m => m.enabled)\n        : [\n            {\n              id: `${typedInput.modelConfig.provider}/${typedInput.modelConfig.modelId}`,\n              config: typedInput.modelConfig,\n              maxRetries: 0,\n              enabled: true,\n            },\n          ];\n\n      if (modelList.length === 0) {\n        throw new Error('No enabled models available for execution');\n      }\n\n      // 4. Execute with model fallback - try each model in the list with retries\n      let lastError: Error | undefined;\n      let processorRetryCount = 0;\n      const maxProcessorRetries =\n        typedInput.options?.maxProcessorRetries ??\n        (globalRunRegistry.get(runId)?.errorProcessors?.length ? 10 : undefined);\n\n      // Hoisted: a retry must keep the id an error processor rotated to.\n      let currentMessageId = messageId;\n      const rotateResponseMessageId = () => {\n        currentMessageId = messageList.rotateResponseMessageId(currentMessageId);\n        return currentMessageId;\n      };\n\n      for (let modelIndex = 0; modelIndex < modelList.length; modelIndex++) {\n        const modelEntry = modelList[modelIndex]!;","sourceCodeStart":283,"sourceCodeEnd":319,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/core/src/agent/durable/workflows/steps/llm-execution.ts#L283-L319","documentation":"createDurableLLMExecutionStep builds a model list from the agent's configured models after filtering for enabled entries. If the resulting list is empty there is nothing to execute (no fallback candidates at all), so the durable LLM step throws before any execution attempt.","triggerScenarios":"A durable agent run whose model configuration resolves to zero enabled models — e.g. all models in a model-router/fallback list are disabled, or the enabled flag evaluates false for every entry.","commonSituations":"Feature-flagged model configs disabling every candidate, env-driven enablement (ENABLE_MODEL_X=false) accidentally disabling all models, or misconfigured model routers where the enabled flag defaults off.","solutions":["Enable at least one model in the agent's model configuration.","Check env/flags that control model enablement to ensure at least one candidate is active.","Inspect the resolved model config (step output before execution) to confirm which models were filtered out and why."],"exampleFix":"// before\nmodels: [\n  { model: openai('gpt-4o'), enabled: false },\n  { model: anthropic('claude-3-5-sonnet'), enabled: false },\n]\n// after\nmodels: [\n  { model: openai('gpt-4o'), enabled: true, maxRetries: 0 },\n  { model: anthropic('claude-3-5-sonnet'), enabled: true },\n]","handlingStrategy":"validation","validationCode":"const enabled = modelConfigs.filter(m => m.enabled);\nif (enabled.length === 0) {\n  throw new Error('At least one enabled model is required for durable LLM execution');\n}","typeGuard":null,"tryCatchPattern":"try {\n  await durableAgent.generate({ messages });\n} catch (e) {\n  if (e instanceof Error && e.message === 'No enabled models available for execution') {\n    logger.error('All models disabled — check model config / feature flags');\n  }\n  throw e;\n}","preventionTips":["Ensure feature-flag/env-based enablement logic can never disable every model (guard with a required minimum of one enabled)","Add a CI test asserting each agent's model list contains at least one enabled model","Log filtered-out models with reasons during config resolution"],"tags":["model","configuration","durable-agent","fallback"],"backgroundTag":"no-enabled-models","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}