mastra-ai/mastra · error · HTTPException
agent thread aborts are not supported by this Mastra core…
Error message
agent thread aborts are not supported by this Mastra core version
What it means
The abort-thread handler checks that the agent instance implements abortThreadStream. Older core versions lack thread-level abort, so the server returns HTTP 501 Not Implemented rather than throwing an opaque TypeError. It signals the deployment's core is too old for this endpoint.
Solutions
- Upgrade @mastra/core to a version with abortThreadStream support
- Rebuild/redeploy the server so it binds the updated core
- Check all @mastra/* versions are aligned after the upgrade (pnpm why @mastra-core / pnpm ls)
Example fix
// before pnpm add @mastra/core@0.10.0 // after pnpm add @mastra/core@latest && pnpm build && redeploy
Defensive patterns
Strategy: type-guard
Validate before calling
function agentSupportsAbort(agent: unknown): boolean {
return typeof (agent as { abortThreadStream?: unknown })?.abortThreadStream === 'function';
} Type guard
function supportsAbort(a: unknown): a is { abortThreadStream: Function } {
return !!a && typeof (a as { abortThreadStream?: unknown }).abortThreadStream === 'function';
} Try / catch
try {
await abortThread(agentId, { resourceId, threadId });
} catch (e) {
if (e?.status === 501) console.warn('Thread aborts unsupported on this core version; upgrade @mastra/core');
else throw e;
} Prevention
- Gate abort UI behind a capability check on the agent object
- Upgrade core before exposing abort endpoints in production
- Restart/redeploy after core upgrades so the running server picks up new agent methods
When it happens
Trigger: Calling the agent thread abort endpoint (DELETE/POST on the thread abort route) against an agent without an abortThreadStream function — i.e. pre-abort-support @mastra/core.
Common situations: Upgraded server/playground but not core; running against an old mastra deploy; custom agent implementations missing the method.
Related errors
- agent is not supported by this Mastra core version
- agent signals are not supported by this Mastra core version
- agent thread subscriptions are not supported by this Mastra…
- threadId is required
- AbortError
AI-assisted analysis of mastra-ai/mastra@75dd419e61 (2026-08-30).
Data as JSON: /api/errors/9dce65f853441275.
Report an issue: GitHub.
Appendix: source
Thrown at packages/server/src/server/handlers/agents.ts:2158
});
export const ABORT_AGENT_THREAD_ROUTE = createRoute({
method: 'POST',
path: '/agents/:agentId/threads/abort',
responseType: 'json' as const,
pathParamSchema: agentIdPathParams,
bodySchema: abortAgentThreadBodySchema,
responseSchema: abortAgentThreadResponseSchema,
summary: 'Abort active agent thread run',
description: 'Aborts the currently active stream run for a memory thread without changing thread subscriptions',
tags: ['Agents', 'Streaming'],
requiresAuth: true,
requiresPermission: 'agents:execute',
handler: async ({ mastra, agentId, resourceId, threadId, requestContext: serverRequestContext }) => {
try {
const agent = await getAgentFromSystem({ mastra, agentId, requestContext: serverRequestContext });
if (typeof (agent as { abortThreadStream?: unknown }).abortThreadStream !== 'function') {
throw new HTTPException(501, {
message: 'agent thread aborts are not supported by this Mastra core version',
});
}
const effectiveResourceId = getEffectiveResourceId(serverRequestContext, resourceId);
const effectiveThreadId = getEffectiveThreadId(serverRequestContext, threadId);
if (!effectiveThreadId) {
throw new HTTPException(400, { message: 'threadId is required' });
}
if (effectiveResourceId) {
const memory = await agent.getMemory({ requestContext: serverRequestContext });
if (memory) {
const thread = await memory.getThreadById({ threadId: effectiveThreadId });
await validateThreadOwnership(thread, effectiveResourceId);
}
}View on GitHub (pinned to 75dd419e61)