mastra-ai/mastra · error · HTTPException

Channels require a newer version of @mastra/core

Error message

Channels require a newer version of @mastra/core

What it means

assertChannelsAvailable is a feature gate: it throws a 501 HTTPException when the installed @mastra/core does not expose the 'channels' feature (coreFeatures.has('channels') is false). All channel routes (list platforms, list installations, connect, disconnect) are gated by it. 501 signals that this server version cannot serve channels because its core dependency predates the feature.

Source

Thrown at packages/server/src/server/handlers/channels.ts:28

  channelAgentPathParams,
  connectChannelBodySchema,
  listChannelPlatformsResponseSchema,
  listChannelInstallationsResponseSchema,
  connectChannelResponseSchema,
  disconnectChannelResponseSchema,
} from '../schemas/channels';
import { createRoute } from '../server-adapter/routes/route-builder';

import { assertWriteAccess, getCallerAuthorId, hasAdminBypass, hasScopedPermission } from './authorship';
import { handleError } from './error';

// ============================================================================
// Feature gate + helpers
// ============================================================================

function assertChannelsAvailable(): void {
  if (!coreFeatures.has('channels')) {
    throw new HTTPException(501, { message: 'Channels require a newer version of @mastra/core' });
  }
}

function getChannelOrThrow(mastra: Mastra, platform: string): ChannelProvider {
  const channels = Object.values(mastra.channels ?? {});
  const channel = channels.find(c => c.id === platform);
  if (!channel) {
    const available = channels.map(c => c.id).join(', ');
    throw new HTTPException(404, {
      message: `Channel "${platform}" is not registered. Available: ${available || 'none'}`,
    });
  }
  return channel;
}

/**
 * Unified connect/disconnect authorization.
 *

View on GitHub (pinned to 75dd419e61)

Solutions

  1. Upgrade @mastra/core to a version that includes the channels feature (matching the @mastra/server version's requirement).
  2. Run your package manager install to reconcile workspace/lockfile versions of @mastra/core and @mastra/server.
  3. Verify coreFeatures picks up 'channels' at runtime (check the resolved core version actually installed, not the one in your manifest).
  4. Rebuild/redeploy the server after the upgrade so the feature detection runs against the new core.

Example fix

// before
"dependencies": { "@mastra/core": "^0.10.0", "@mastra/server": "^0.12.0" }

// after
"dependencies": { "@mastra/core": "^0.12.0", "@mastra/server": "^0.12.0" } // core supports channels
// then: pnpm install && rebuild server
Defensive patterns

Strategy: fallback

Validate before calling

import { coreFeatures } from '@mastra/core'; // or check installed core version
if (!coreFeatures.has('channels')) {
  console.warn('channels unsupported by installed @mastra/core — hiding channel UI');
}

Type guard

function channelsSupported(coreVersion: string): boolean {
  return semver.gte(coerce(coreVersion) ?? '0.0.0', MIN_CORE_VERSION_WITH_CHANNELS);
}

Try / catch

try {
  await listChannelPlatforms();
} catch (e) {
  if (e.status === 501 && e.message.includes('newer version of @mastra/core')) {
    // degrade gracefully: hide channels feature, prompt upgrade
  } else throw e;
}

Prevention

When it happens

Trigger: Calling any /api/channels* route (list platforms, list installations, connect, disconnect) on a server built against an @mastra/core version without the channels feature export.

Common situations: Partial upgrade — @mastra/server updated but @mastra/core left old; monorepo dependency drift where the resolved core is stale; a custom build where the channels feature flag is absent.

Related errors


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