mastra-ai/mastra · error · HTTPException

Tool provider ${providerId} does not support getAuthStatus

Error message

Tool provider ${providerId} does not support getAuthStatus

What it means

HTTP 400 thrown by the auth-status handler when the provider does not implement the optional getAuthStatus method. Checking whether an authorization attempt completed is provider-specific, so providers lacking it cannot report auth status.

Source

Thrown at packages/server/src/server/handlers/tool-providers.ts:364

/**
 * GET /tool-providers/:providerId/auth-status/:authId — Poll OAuth flow status.
 */
export const GET_TOOL_PROVIDER_AUTH_STATUS_ROUTE = createRoute({
  method: 'GET',
  path: '/tool-providers/:providerId/auth-status/:authId',
  responseType: 'json',
  pathParamSchema: toolProviderAuthStatusPathParams,
  responseSchema: authStatusToolProviderResponseSchema,
  summary: 'Get tool provider auth status',
  description: 'Polls the OAuth flow status for an outstanding authorize call',
  tags: ['Tool Providers'],
  requiresAuth: true,
  handler: async ({ mastra, providerId, authId }) => {
    try {
      const editor = requireEditor(mastra.getEditor());
      const provider = await resolveProvider(editor, providerId);
      if (!provider.getAuthStatus) {
        throw new HTTPException(400, { message: `Tool provider ${providerId} does not support getAuthStatus` });
      }
      const status = await provider.getAuthStatus(authId);
      return { status };
    } catch (error) {
      return handleError(error, 'Error getting tool provider auth status');
    }
  },
});

/**
 * POST /tool-providers/:providerId/connection-status — Batch-check connection liveness.
 */
export const TOOL_PROVIDER_CONNECTION_STATUS_ROUTE = createRoute({
  method: 'POST',
  path: '/tool-providers/:providerId/connection-status',
  responseType: 'json',
  pathParamSchema: toolProviderIdPathParams,
  bodySchema: connectionStatusToolProviderBodySchema,

View on GitHub (pinned to 75dd419e61)

Solutions

  1. Implement getAuthStatus(authId) on the ToolProvider and re-register it.
  2. Skip status polling for this provider and treat authorization as synchronous if the flow allows.
  3. Upgrade the provider package to a version implementing getAuthStatus.
  4. Check provider capabilities before starting an async auth flow so the UI uses a supported flow.

Example fix

// before
const { status } = await api.getAuthStatus(providerId, authId); // 400 if unsupported
// after
const supportsStatus = providerHasMethod(providerId, 'getAuthStatus');
const status = supportsStatus ? await api.getAuthStatus(providerId, authId) : 'unsupported';
Defensive patterns

Strategy: try-catch

Validate before calling

const provider = await api.getProvider(providerId);
if (typeof provider?.getAuthStatus !== 'function') {
  return { status: 'unsupported' as const };
}

Type guard

function supportsGetAuthStatus(p: ToolProvider): p is ToolProvider & Required<Pick<ToolProvider, 'getAuthStatus'>> {
  return typeof p.getAuthStatus === 'function';
}

Try / catch

try {
  return await api.getAuthStatus(providerId, authId);
} catch (e) {
  if (e.status === 400 && /does not support getAuthStatus/.test(e.message)) return { status: 'unsupported' };
  throw e;
}

Prevention

When it happens

Trigger: GET /api/tool-providers/:providerId/auth-status/:authId (tool-providers.ts:364) against a provider registered without getAuthStatus.

Common situations: Polling auth status after starting an OAuth flow on a provider that doesn't support status checks; custom provider implemented without the method; SDK/frontend assumes all providers expose status polling.

Related errors


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