mastra-ai/mastra · warning · MastraError

DEPRECATED_ENDPOINT

DEPRECATED_ENDPOINT

Error message

This endpoint is deprecated. Please use the @mastra/ai-sdk package to for uiMessage transformations

What it means

This HTTP error (with MastraError id DEPRECATED_ENDPOINT) is thrown by a deprecated uiMessage transformation route. The transformation was moved into the @mastra/ai-sdk package, so the server-side route now refuses to execute and instructs callers to do the transformation client-side with that package.

Source

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

  },
});

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 {
      throw new MastraError({
        category: ErrorCategory.USER,
        domain: ErrorDomain.MASTRA_SERVER,
        id: 'DEPRECATED_ENDPOINT',
        text: 'This endpoint is deprecated. Please use the @mastra/ai-sdk package to for uiMessage transformations',
      });
    } catch (error) {
      return handleError(error, 'error streaming agent response');
    }
  },
});

export const STREAM_UI_MESSAGE_DEPRECATED_ROUTE = createRoute({
  method: 'POST',
  path: '/agents/:agentId/stream/ui',
  responseType: 'stream',
  pathParamSchema: agentIdPathParams,
  bodySchema: agentExecutionBodySchema,
  responseSchema: streamResponseSchema,

View on GitHub (pinned to 75dd419e61)

Solutions

  1. Install @mastra/ai-sdk and perform the uiMessage transformation in your client code (e.g. `toUIMessageStreamResponse`-style helpers it exports).
  2. Update client code to stop calling the deprecated endpoint.
  3. Check the @mastra/ai-sdk docs for the exact replacement function for your former endpoint usage.

Example fix

// before
const res = await fetch(`/api/agents/${id}/ui`, { method: 'POST', body });
// after
import { toUIMessageStream } from '@mastra/ai-sdk';
const stream = toUIMessageStream(agentStream);
Defensive patterns

Strategy: try-catch

Try / catch

try {
  const res = await fetch(`/api/agents/${id}/ui`, { method: 'POST', body });
  if (res.status === 410) {
    throw new Error('Use @mastra/ai-sdk for uiMessage transformations instead of this endpoint');
  }
} catch (e) {
  // fall back to client-side transformation via @mastra/ai-sdk
}

Prevention

When it happens

Trigger: POSTing to the deprecated uiMessage transformation endpoint (route marked `deprecated: true` at packages/server/src/server/handlers/agents.ts:3574).

Common situations: Applications relying on the old server-side UI-message conversion after the logic was extracted to @mastra/ai-sdk; upgrading the server without updating client transformation code.

Related errors


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