{"record":{"id":"a21c7eedbc0761d3","repo":"mastra-ai/mastra","slug":"processor-returned-unsupported-model","errorCode":"PROCESSOR_RETURNED_UNSUPPORTED_MODEL","errorMessage":"Processor ${processor.id} returned an unsupported model version ${resolvedModel.specificationVersion} in step ${stepNumber}. Only ${supportedLanguageModelSpecifications.join(', ')} models are supported in processInputStep.","messagePattern":"Processor (.+?) returned an unsupported model version (.+?) in step (.+?)\\. Only (.+?) models are supported in processInputStep\\.","errorType":"error_code","errorClass":"MastraError","httpStatus":null,"severity":"error","filePath":"packages/core/src/processors/runner.ts","lineNumber":2613,"sourceCode":"          domain: 'AGENT',\n          id: 'PROCESSOR_RETURNED_EXTERNAL_MESSAGE_LIST',\n          text: `Processor ${processor.id} returned a MessageList instance other than the one that was passed in as an argument. New external message list instances are not supported. Use the messageList argument instead.`,\n        });\n      }\n      if (result.messages && result.messageList) {\n        throw new MastraError({\n          category: 'USER',\n          domain: 'AGENT',\n          id: 'PROCESSOR_RETURNED_MESSAGES_AND_MESSAGE_LIST',\n          text: `Processor ${processor.id} returned both messages and messageList. Only one of these is allowed.`,\n        });\n      }\n      const { model: _model, ...rest } = result;\n      if (result.model) {\n        const resolvedModel = await resolveModelConfig(result.model);\n        const isSupported = isSupportedLanguageModel(resolvedModel);\n        if (!isSupported) {\n          throw new MastraError({\n            category: 'USER',\n            domain: 'AGENT',\n            id: 'PROCESSOR_RETURNED_UNSUPPORTED_MODEL',\n            text: `Processor ${processor.id} returned an unsupported model version ${resolvedModel.specificationVersion} in step ${stepNumber}. Only ${supportedLanguageModelSpecifications.join(', ')} models are supported in processInputStep.`,\n          });\n        }\n\n        return {\n          model: resolvedModel,\n          ...rest,\n        };\n      }\n\n      return rest;\n    }\n\n    return {};\n  }","sourceCodeStart":2595,"sourceCodeEnd":2631,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/core/src/processors/runner.ts#L2595-L2631","documentation":"Thrown when a processor's `processInputStep` returns a result with a `model` that resolves to a LanguageModel whose `specificationVersion` is not in the supported set (e.g. not LanguageModelV2/V3). The runner validates the resolved model per input step so the LLM call won't fail downstream with an incompatible model interface.","triggerScenarios":"A processor overrides the step model via `result.model` with: a raw provider SDK client (not an AI SDK model); a model specificationVersion outside `supportedLanguageModelSpecifications` (e.g. V1 from an old @ai-sdk version); an object that resolves to an unsupported shape.","commonSituations":"Mixing @ai-sdk v1 and v2 packages in one app so the wrong specificationVersion is produced; passing a provider's native client instead of `provider(modelId)`; hardcoding a model router result that predates the supported spec.","solutions":["Upgrade/downgrade the model package so the model's specificationVersion matches the supported versions listed in the error.","Construct the model with the AI SDK's provider factory (e.g. `openai('gpt-4o')`) rather than a raw SDK client.","Use the same model config shape the agent itself accepts (resolveModelConfig-compatible), and verify `resolveModelConfig(result.model).specificationVersion` before returning it."],"exampleFix":"// before: raw SDK client returned from processor\nreturn { model: new OpenAIClient().chat, messages };\n\n// after: AI SDK model with supported specificationVersion\nimport { openai } from '@ai-sdk/openai';\nreturn { model: openai('gpt-4o'), messages };","handlingStrategy":"validation","validationCode":"const resolved = await resolveModelConfig(result.model);\nif (!isSupportedLanguageModel(resolved)) {\n  throw new Error(\n    `Model specificationVersion ${resolved.specificationVersion} is unsupported; use one of: ${supportedLanguageModelSpecifications.join(', ')}`,\n  );\n}","typeGuard":"function isSupportedLanguageModel(\n  m: unknown,\n): m is { specificationVersion: 'v2' | 'v3' } {\n  return !!m && typeof m === 'object' &&\n    (m as any).specificationVersion !== undefined &&\n    supportedLanguageModelSpecifications.includes((m as any).specificationVersion);\n}","tryCatchPattern":"try {\n  const res = await agent.generate(input);\n} catch (e) {\n  if (e instanceof MastraError && e.id === 'PROCESSOR_RETURNED_UNSUPPORTED_MODEL') {\n    console.error(`Processor model unsupported: ${e.message}`);\n    return runWithDefaultModel(input);\n  }\n  throw e;\n}","preventionTips":["Keep all AI SDK provider packages on one major version so specificationVersions align.","Only return models created via AI SDK provider factories, never raw provider SDK clients.","Assert the resolved specificationVersion in processor tests before release."],"tags":["processors","model-resolution","ai-sdk","version-mismatch"],"backgroundTag":"unsupported-model-specification-version","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}