mastra-ai/mastra · critical · Error
No enabled models available for execution
Error message
No enabled models available for execution
What it means
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.
Source
Thrown at packages/core/src/agent/durable/workflows/steps/llm-execution.ts:301
// 2. Determine if we have a model list for fallback support
const hasModelList = typedInput.modelList && typedInput.modelList.length > 0;
// 3. Build the model list - either from explicit list or single model
// For single model case (no modelList), we use the resolved model directly
// which supports mock models and directly-provided models
const modelList = hasModelList
? typedInput.modelList!.filter(m => m.enabled)
: [
{
id: `${typedInput.modelConfig.provider}/${typedInput.modelConfig.modelId}`,
config: typedInput.modelConfig,
maxRetries: 0,
enabled: true,
},
];
if (modelList.length === 0) {
throw new Error('No enabled models available for execution');
}
// 4. Execute with model fallback - try each model in the list with retries
let lastError: Error | undefined;
let processorRetryCount = 0;
const maxProcessorRetries =
typedInput.options?.maxProcessorRetries ??
(globalRunRegistry.get(runId)?.errorProcessors?.length ? 10 : undefined);
// Hoisted: a retry must keep the id an error processor rotated to.
let currentMessageId = messageId;
const rotateResponseMessageId = () => {
currentMessageId = messageList.rotateResponseMessageId(currentMessageId);
return currentMessageId;
};
for (let modelIndex = 0; modelIndex < modelList.length; modelIndex++) {
const modelEntry = modelList[modelIndex]!;View on GitHub (pinned to 75dd419e61)
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.
Example fix
// before
models: [
{ model: openai('gpt-4o'), enabled: false },
{ model: anthropic('claude-3-5-sonnet'), enabled: false },
]
// after
models: [
{ model: openai('gpt-4o'), enabled: true, maxRetries: 0 },
{ model: anthropic('claude-3-5-sonnet'), enabled: true },
] Defensive patterns
Strategy: validation
Validate before calling
const enabled = modelConfigs.filter(m => m.enabled);
if (enabled.length === 0) {
throw new Error('At least one enabled model is required for durable LLM execution');
} Try / catch
try {
await durableAgent.generate({ messages });
} catch (e) {
if (e instanceof Error && e.message === 'No enabled models available for execution') {
logger.error('All models disabled — check model config / feature flags');
}
throw e;
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Agent model not available
- DURABLE_AGENT_RECOVER_NO_MASTRA
- DURABLE_AGENT_RECOVER_NO_STORAGE
- Unsupported model version: ${(model as any).specificationVer
- AGENT_FS_ROUTING_MODEL_REQUIRED
AI-assisted analysis of mastra-ai/mastra@75dd419e61 (2026-08-30).
Data as JSON: /api/errors/645bef9717cae4d6.
Report an issue: GitHub.