{"record":{"id":"5447fe05871843b9","repo":"yikart/AiToEarn","slug":"platformnotsupported-5447fe","errorCode":"PlatformNotSupported","errorMessage":"ResponseCode.PlatformNotSupported","messagePattern":"ResponseCode\\.PlatformNotSupported","errorType":"exception","errorClass":"AppException","httpStatus":null,"severity":"error","filePath":"project/aitoearn-backend/apps/aitoearn-server/src/core/channels/mcp/channels.mcp.service.ts","lineNumber":105,"sourceCode":"  async updateChannelPublishAt(userId: string, params: UpdateChannelPublishAtParams) {\n    await this.publishTaskService.updatePublishAt(userId, params.taskId, params.publishAt)\n    return { taskId: params.taskId, publishAt: params.publishAt }\n  }\n\n  async requestChannelPublishUpdate(userId: string, params: RequestChannelPublishUpdateParams) {\n    await this.publishTaskService.requestUpdate(userId, params.taskId, params.data)\n    return { taskId: params.taskId }\n  }\n\n  async listChannelPlatforms() {\n    return this.registry.listMetadata()\n  }\n\n  async getChannelPlatform(params: ChannelPlatformParams) {\n    const platform = this.registry.listMetadata()\n      .find(item => item.platform === params.platform)\n    if (!platform) {\n      throw new AppException(ResponseCode.PlatformNotSupported, { platform: params.platform })\n    }\n    return platform\n  }\n\n  async listBilibiliChannelPlatformCategories(userId: string, params: ListBilibiliChannelPlatformCategoriesParams) {\n    return this.platformsService.getAccountValues(\n      userId,\n      params.accountId,\n      'tid',\n    )\n  }\n\n  async listYoutubeChannelPlatformCategories(userId: string, params: ListYoutubeChannelPlatformCategoriesParams) {\n    return this.platformsService.getAccountValues(\n      userId,\n      params.accountId,\n      'categoryId',\n      {","sourceCodeStart":87,"sourceCodeEnd":123,"githubUrl":"https://github.com/yikart/AiToEarn/blob/d3aa8bea5b146a8675607cf0144d891aad3e9683/project/aitoearn-backend/apps/aitoearn-server/src/core/channels/mcp/channels.mcp.service.ts#L87-L123","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Log or inspect registry.listMetadata() to get the exact supported platform identifiers and use one verbatim.","Fix casing/typos in the platform parameter (matching is exact === on item.platform).","If the platform should exist, register its provider/metadata in the channels registry module before the service is used.","Catch AppException with code PlatformNotSupported and return a friendly 'unsupported platform' message listing valid platforms."],"exampleFix":"// before\nawait mcp.getChannelPlatform({ platform: 'Bilibili' })\n\n// after\nawait mcp.getChannelPlatform({ platform: 'bilibili' }) // exact registry key","handlingStrategy":"validation","validationCode":"const supported = mcp.listSupportedPlatforms() // from registry.listMetadata()\nif (!supported.includes(params.platform)) {\n  throw new Error(`Unsupported platform: ${params.platform}. Valid: ${supported.join(', ')}`)\n}","typeGuard":"function isSupportedPlatform(p: string, platforms: { platform: string }[]): p is string {\n  return platforms.some(item => item.platform === p)\n}","tryCatchPattern":"try {\n  const platform = await mcp.getChannelPlatform({ platform: p })\n} catch (e) {\n  if (e.code === 'PlatformNotSupported') return res.status(400).json({ message: 'Unsupported platform', platform: p })\n  throw e\n}","preventionTips":["Always source platform identifiers from registry metadata, never free-form user input","Keep a shared constant/enum of valid platform keys used by clients and server","Verify new platform adapters are registered in every environment's bootstrap module"],"tags":["platform","validation","mcp","registry"],"backgroundTag":"unsupported-platform","analyzedSha":"d3aa8bea5b146a8675607cf0144d891aad3e9683","analyzedAt":"2026-08-31T14:19:24.185Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}