mastra-ai/mastra · warning · HTTPException

This endpoint is deprecated. Please use /stream instead.

Error message

This endpoint is deprecated. Please use /stream instead.

What it means

This HTTP 410 (Gone) error is thrown unconditionally by a deprecated agent streaming route handler. The endpoint no longer does any work; it exists only to tell clients the route is gone and that /stream should be used instead.

Source

Thrown at packages/server/src/server/handlers/agents.ts:3555

      return handleError(error, 'Error enhancing instructions');
    }
  },
});

export const STREAM_VNEXT_DEPRECATED_ROUTE = createRoute({
  method: 'POST',
  path: '/agents/:agentId/streamVNext',
  responseType: 'stream',
  pathParamSchema: agentIdPathParams,
  bodySchema: agentExecutionBodySchema,
  responseSchema: streamResponseSchema,
  summary: 'Stream a response from an agent',
  description: '[DEPRECATED] This endpoint is deprecated. Please use /stream instead.',
  tags: ['Agents'],
  requiresAuth: true,
  deprecated: true,
  handler: async () => {
    throw new HTTPException(410, { message: 'This endpoint is deprecated. Please use /stream instead.' });
  },
});

export const STREAM_UI_MESSAGE_VNEXT_DEPRECATED_ROUTE = createRoute({
  method: 'POST',
  path: '/agents/:agentId/stream/vnext/ui',
  responseType: 'stream',
  pathParamSchema: agentIdPathParams,
  bodySchema: agentExecutionBodySchema,
  responseSchema: streamResponseSchema,
  summary: 'Stream UI messages from an agent',
  description:
    '[DEPRECATED] This endpoint is deprecated. Please use the @mastra/ai-sdk package for uiMessage transformations',
  tags: ['Agents'],
  requiresAuth: true,
  deprecated: true,
  handler: async () => {
    try {

View on GitHub (pinned to 75dd419e61)

Solutions

  1. Change the client to POST /api/agents/:agentId/stream instead of the deprecated endpoint.
  2. Upgrade @mastra/client-js (or your custom fetch wrapper) to a version that targets the /stream route.
  3. Remove any references to the deprecated path in proxy/rewriting layers in front of the server.

Example fix

// before
await fetch(`/api/agents/${id}/generate`, { method: 'POST', body });
// after
await fetch(`/api/agents/${id}/stream`, { method: 'POST', body });
Defensive patterns

Strategy: fallback

Try / catch

async function streamAgent(id, body) {
  let res = await fetch(`/api/agents/${id}/stream`, { method: 'POST', body });
  if (res.status === 410) {
    // old server / old path: retry once against legacy route or surface upgrade notice
    res = await fetch(`/api/agents/${id}/generate`, { method: 'POST', body });
  }
  return res;
}

Prevention

When it happens

Trigger: POSTing to the deprecated agent streaming endpoint (the route marked `deprecated: true` at packages/server/src/server/handlers/agents.ts:3555).

Common situations: Client code or an SDK built against an older Mastra API still calls the legacy generate/stream route after upgrading the server to a version where the route was removed.

Related errors


AI-assisted analysis of mastra-ai/mastra@75dd419e61 (2026-08-30). Data as JSON: /api/errors/80d12478134165dc. Report an issue: GitHub.