{"record":{"id":"cf1237697938cdbd","repo":"mastra-ai/mastra","slug":"unsupported-model-version-currentstep-model-as","errorCode":null,"errorMessage":"Unsupported model version: ${(currentStep.model as { specificationVersion?: string }).specificationVersion}. Supported versions: ${supportedLanguageModelSpecifications.join(', ')}","messagePattern":"Unsupported model version: (.+?)\\)\\.specificationVersion\\}\\. Supported versions: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/core/src/loop/workflows/agentic-execution/llm-execution-step.ts","lineNumber":1780,"sourceCode":"                    messageId: currentStep.messageId,\n                  });\n\n                  return {\n                    runId,\n                    from: ChunkFrom.AGENT,\n                    type: 'step-start',\n                    payload: {\n                      request: request || {},\n                      warnings: warnings || [],\n                      messageId: currentStep.messageId,\n                    },\n                  };\n                },\n                shouldThrowError: !isLastModel,\n              }),\n          });\n        } else {\n          throw new Error(\n            `Unsupported model version: ${(currentStep.model as { specificationVersion?: string }).specificationVersion}. Supported versions: ${supportedLanguageModelSpecifications.join(', ')}`,\n          );\n        }\n\n        const outputStream = new MastraModelOutput<OUTPUT>({\n          model: {\n            modelId: currentStep.model.modelId,\n            provider: currentStep.model.provider,\n            version: currentStep.model.specificationVersion,\n          },\n          stream: modelResult as ReadableStream<ChunkType<OUTPUT>>,\n          messageList,\n          messageId: currentStep.messageId,\n          options: {\n            runId,\n            toolCallStreaming,\n            includeRawChunks,\n            structuredOutput: currentStep.structuredOutput,","sourceCodeStart":1762,"sourceCodeEnd":1798,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/core/src/loop/workflows/agentic-execution/llm-execution-step.ts#L1762-L1798","documentation":"The agentic LLM execution step only supports models implementing the known AI SDK LanguageModelV specification versions (supportedLanguageModelSpecifications). If currentStep.model.specificationVersion is not one of them, the step throws a plain Error listing the supported versions. This happens when a model object from an incompatible AI SDK/provider version is passed.","triggerScenarios":"Passing a model instance whose specificationVersion (e.g. 'v1' vs 'v2'/'v3') does not match the AI SDK version bundled with this Mastra core — typically via agent.model, a workflow step's model, or dynamic model resolution returning a raw provider model built against a mismatched @ai-sdk/* major.","commonSituations":"Mixing @ai-sdk/provider v1-based models with an AI SDK v5-based Mastra (or vice versa); constructing a custom LanguageModel wrapper with a stale specificationVersion; passing a provider string resolved to an incompatible gateway model; duplicate model entries in a fallback chain where one model is on the wrong spec (note shouldThrowError/!isLastModel handling just above).","solutions":["Upgrade or downgrade the provider package (@ai-sdk/openai, @ai-sdk/anthropic, etc.) so its specificationVersion matches the versions listed in the error message.","Upgrade @mastra/core (and @mastra/ai-sdk integration) so it supports the model's specificationVersion.","If using a custom model, implement the required LanguageModelV specification version interface.","Log/inspect model.specificationVersion at workflow construction to catch the mismatch early."],"exampleFix":"// before\nimport { generate } from 'ai@v4'; // model.specificationVersion = 'v1'\nconst workflow = createWorkflow(...).then(agentStep({ model: openai('gpt-4o') }));\n// after\npnpm add @ai-sdk/openai@^2 ai@^5  // model.specificationVersion = 'v2'\nconst workflow = createWorkflow(...).then(agentStep({ model: openai('gpt-4o') }));","handlingStrategy":"validation","validationCode":"const supported = ['v1','v2']; // see supportedLanguageModelSpecifications for your @mastra/core version\nconst model = await resolveModel(step.model);\nif (!supported.includes(model.specificationVersion)) {\n  throw new Error(`Model spec ${model.specificationVersion} unsupported; upgrade provider packages`);\n}","typeGuard":"function isSupportedLanguageModel(m: unknown): m is { specificationVersion: string; doGenerate: Function } {\n  return !!m && typeof m === 'object' && ['v1','v2'].includes((m as any).specificationVersion) && typeof (m as any).doGenerate === 'function';\n}","tryCatchPattern":"try {\n  await workflow.start({ inputData });\n} catch (e) {\n  if (e instanceof Error && e.message.startsWith('Unsupported model version:')) {\n    console.error('Fix @ai-sdk/provider package versions to match Mastra core');\n  }\n  throw e;\n}","preventionTips":["Pin @ai-sdk/* provider packages to versions compatible with your @mastra/core","Keep ai and @ai-sdk/provider on the same major","Add a smoke test that runs a model through the agentic execution step after upgrades"],"tags":["ai-sdk","model-version","workflow","compatibility"],"backgroundTag":"unsupported-model-specification-version","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}