yikart/AiToEarn · error · AppException

PlatformNotSupported

PlatformNotSupported

Error message

ResponseCode.PlatformNotSupported

What it means

getChannelPlatform looks up channel registry metadata by platform identifier. It throws PlatformNotSupported when no registered platform metadata matches params.platform. This means the requested platform string is not a platform the backend has an adapter registered for.

Source

Thrown at project/aitoearn-backend/apps/aitoearn-server/src/core/channels/mcp/channels.mcp.service.ts:105

  async updateChannelPublishAt(userId: string, params: UpdateChannelPublishAtParams) {
    await this.publishTaskService.updatePublishAt(userId, params.taskId, params.publishAt)
    return { taskId: params.taskId, publishAt: params.publishAt }
  }

  async requestChannelPublishUpdate(userId: string, params: RequestChannelPublishUpdateParams) {
    await this.publishTaskService.requestUpdate(userId, params.taskId, params.data)
    return { taskId: params.taskId }
  }

  async listChannelPlatforms() {
    return this.registry.listMetadata()
  }

  async getChannelPlatform(params: ChannelPlatformParams) {
    const platform = this.registry.listMetadata()
      .find(item => item.platform === params.platform)
    if (!platform) {
      throw new AppException(ResponseCode.PlatformNotSupported, { platform: params.platform })
    }
    return platform
  }

  async listBilibiliChannelPlatformCategories(userId: string, params: ListBilibiliChannelPlatformCategoriesParams) {
    return this.platformsService.getAccountValues(
      userId,
      params.accountId,
      'tid',
    )
  }

  async listYoutubeChannelPlatformCategories(userId: string, params: ListYoutubeChannelPlatformCategoriesParams) {
    return this.platformsService.getAccountValues(
      userId,
      params.accountId,
      'categoryId',
      {

View on GitHub (pinned to d3aa8bea5b)

Solutions

  1. Log or inspect registry.listMetadata() to get the exact supported platform identifiers and use one verbatim.
  2. Fix casing/typos in the platform parameter (matching is exact === on item.platform).
  3. If the platform should exist, register its provider/metadata in the channels registry module before the service is used.
  4. Catch AppException with code PlatformNotSupported and return a friendly 'unsupported platform' message listing valid platforms.

Example fix

// before
await mcp.getChannelPlatform({ platform: 'Bilibili' })

// after
await mcp.getChannelPlatform({ platform: 'bilibili' }) // exact registry key
Defensive patterns

Strategy: validation

Validate before calling

const supported = mcp.listSupportedPlatforms() // from registry.listMetadata()
if (!supported.includes(params.platform)) {
  throw new Error(`Unsupported platform: ${params.platform}. Valid: ${supported.join(', ')}`)
}

Type guard

function isSupportedPlatform(p: string, platforms: { platform: string }[]): p is string {
  return platforms.some(item => item.platform === p)
}

Try / catch

try {
  const platform = await mcp.getChannelPlatform({ platform: p })
} catch (e) {
  if (e.code === 'PlatformNotSupported') return res.status(400).json({ message: 'Unsupported platform', platform: p })
  throw e
}

Prevention

When it happens

Trigger: Any MCP channel call passing a `platform` param that does not exactly match a registered platform's `platform` value in registry.listMetadata() (typo, wrong casing, or a platform whose provider module was not registered at boot).

Common situations: MCP client passes a platform name like 'youtube_shorts' or 'Twitter' instead of the exact registry key; a new platform adapter exists but its module was not imported/registered in the deployment; environment-specific builds exclude some platform registrations.

Related errors


AI-assisted analysis of yikart/AiToEarn@d3aa8bea5b (2026-08-31). Data as JSON: /api/errors/5447fe05871843b9. Report an issue: GitHub.