{"record":{"id":"e583c340ecae1bec","repo":"mastra-ai/mastra","slug":"agent-methodname-is-not-supported-by-this-mastr","errorCode":null,"errorMessage":"agent ${methodName} is not supported by this Mastra core version","messagePattern":"agent (.+?) is not supported by this Mastra core version","errorType":"http","errorClass":"HTTPException","httpStatus":501,"severity":"error","filePath":"packages/server/src/server/handlers/agents.ts","lineNumber":2065,"sourceCode":"  const effectiveResourceId = getEffectiveResourceId(serverRequestContext, resourceId);\n  const effectiveThreadId = getEffectiveThreadId(serverRequestContext, threadId);\n  const ifIdleWithContext = {\n    ifIdle: {\n      ...(ifIdle ?? {}),\n      streamOptions: { ...(normalizedIdleStreamOptions ?? {}), requestContext: serverRequestContext } as any,\n    },\n  };\n\n  if (effectiveThreadId && effectiveResourceId) {\n    const memory = await agent.getMemory({ requestContext: serverRequestContext });\n    if (memory) {\n      const thread = await memory.getThreadById({ threadId: effectiveThreadId });\n      await validateThreadOwnership(thread, effectiveResourceId);\n    }\n  }\n\n  if (typeof (agent as unknown as Record<string, unknown>)[methodName] !== 'function') {\n    throw new HTTPException(501, { message: `agent ${methodName} is not supported by this Mastra core version` });\n  }\n\n  if (runId) {\n    const result = await agent[methodName](message, {\n      runId,\n      ...(effectiveResourceId ? { resourceId: effectiveResourceId } : {}),\n      ...(effectiveThreadId ? { threadId: effectiveThreadId } : {}),\n      ...(ifActive ? { ifActive } : {}),\n    } as any);\n    const settled = await result.accepted;\n    const settledRunId: string = settled && 'runId' in settled ? settled.runId : runId;\n    return result.signal === undefined\n      ? { accepted: true as const, runId: settledRunId }\n      : { accepted: true as const, runId: settledRunId, signal: result.signal };\n  }\n\n  if (!effectiveResourceId || !effectiveThreadId) {\n    throw new HTTPException(400, { message: 'resourceId and threadId are required when runId is not provided' });","sourceCodeStart":2047,"sourceCodeEnd":2083,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/server/src/server/handlers/agents.ts#L2047-L2083","documentation":"The message handler resolves methodName (e.g. 'stream' or 'generate') and checks the agent instance actually has that function. If the method is missing, the installed core version doesn't support that agent messaging API and the server returns HTTP 501. Like the signal check, this is a capability/version guard.","triggerScenarios":"POSTing to the agent stream/generate message endpoint on an agent whose class lacks the requested method — typically an outdated @mastra/core, or a methodName the installed core doesn't implement (e.g. newer stream APIs on old core).","commonSituations":"Server/frontend packages upgraded ahead of core; custom agent base classes that don't extend the official Agent; proxying a method name from a newer client to an older deployment.","solutions":["Upgrade @mastra/core to a version supporting the invoked method","Align all @mastra/* package versions (server must not be newer than core)","Ensure the agent extends the official Agent class and doesn't delete/override the method"],"exampleFix":"// before (partial upgrade)\n\"@mastra/core\": \"^0.9.0\",\n\"@mastra/server\": \"^0.10.0\"\n// after (aligned)\n\"@mastra/core\": \"^0.10.0\",\n\"@mastra/server\": \"^0.10.0\"","handlingStrategy":"type-guard","validationCode":"function agentSupportsMethod(agent: unknown, methodName: string): boolean {\n  return typeof (agent as Record<string, unknown>)?.[methodName] === 'function';\n}","typeGuard":"function hasAgentMethod(a: unknown, m: 'stream' | 'generate'): a is Record<typeof m, Function> {\n  return !!a && typeof (a as Record<string, unknown>)[m] === 'function';\n}","tryCatchPattern":"try {\n  await agent[methodName](message, opts);\n} catch (e) {\n  if (e?.status === 501) throw new Error(`Core too old for agent.${methodName}; upgrade @mastra/core`);\n  throw e;\n}","preventionTips":["Upgrade all @mastra/* packages together in one change","Pin core to a version known to support the streaming API your client uses","Smoke-test agent stream/generate endpoints after every dependency bump"],"tags":["http-501","version-compatibility","agent-stream","server"],"backgroundTag":"feature-not-supported-version","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}