{"record":{"id":"b78d40c39fdf2b6f","repo":"yikart/AiToEarn","slug":"channelpublishplatformnotsupported","errorCode":"ChannelPublishPlatformNotSupported","errorMessage":"ChannelPublishPlatformNotSupported","messagePattern":"ChannelPublishPlatformNotSupported","errorType":"error_code","errorClass":"AppException","httpStatus":null,"severity":"error","filePath":"project/aitoearn-backend/apps/aitoearn-server/src/core/channels/platforms/platforms.registry.ts","lineNumber":79,"sourceCode":"      throw new AppException(ResponseCode.PlatformNotSupported, { platform })\n    }\n    return registeredPlatform.integration\n  }\n\n  getAuth(platform: AccountType): AuthProvider {\n    const integration = this.get(platform)\n    if (!integration.auth) {\n      this.logger.warn({ platform }, 'Platform does not support auth')\n      throw new AppException(ResponseCode.PlatformNotSupported, { platform, capability: 'auth' })\n    }\n    return integration.auth\n  }\n\n  getPublish(platform: AccountType): PublishProvider {\n    const integration = this.get(platform)\n    if (!integration.publish) {\n      this.logger.warn({ platform }, 'Platform does not support publish')\n      throw new AppException(ResponseCode.ChannelPublishPlatformNotSupported, { platform })\n    }\n    return integration.publish\n  }\n\n  getPublishOptions(platform: AccountType): PublishOptionSourceProvider | undefined {\n    const integration = this.get(platform)\n    return integration.publishOptions\n  }\n\n  getAnalytics(platform: AccountType): AnalyticsProvider | undefined {\n    const integration = this.get(platform)\n    return integration.analytics\n  }\n\n  getEngagement(platform: AccountType): EngagementProvider | undefined {\n    const integration = this.get(platform)\n    return integration.engagement\n  }","sourceCodeStart":61,"sourceCodeEnd":97,"githubUrl":"https://github.com/yikart/AiToEarn/blob/d3aa8bea5b146a8675607cf0144d891aad3e9683/project/aitoearn-backend/apps/aitoearn-server/src/core/channels/platforms/platforms.registry.ts#L61-L97","documentation":"getPublish resolves the platform's PublishProvider. The platform is registered but integration.publish is undefined, meaning the platform does not support publishing content through this system, so it throws ChannelPublishPlatformNotSupported with the platform in the details. Note that unlike getAuth/getPublish, a registered platform must have at least one capability, just not necessarily publish.","triggerScenarios":"Calling publish-related endpoints (create post, getPublishOptions flows, publish task dispatch) for a platform whose integration provides only e.g. analytics, engagement, browse, or webhook capabilities and no publish provider.","commonSituations":"A scheduling UI that lists all connected accounts as publish targets; automated jobs that iterate over accounts and try to publish for each; platform capability changed (publish provider removed due to upstream API shutdown); publishing to a browse/analysis-only integration.","solutions":["Check capabilities.publish.supported in the platform metadata before scheduling or dispatching a publish, and filter account lists accordingly.","Restrict publish target selection in the UI to accounts whose platform declares publish support.","If the platform should be publishable, implement and register a PublishProvider (integration.publish plus metadata.publishPolicy).","Handle this code in publish pipelines by skipping (not retrying) the account and reporting it as unpublishable."],"exampleFix":"// before\nfor (const account of accounts) {\n  await publishService.publish(account.id, payload) // throws for non-publish platforms\n}\n// after\nfor (const account of accounts.filter(a => capabilities[a.type]?.publish.supported)) {\n  await publishService.publish(account.id, payload)\n}","handlingStrategy":"validation","validationCode":"const meta = registry.listMetadata().find(m => m.platform === platform)\nif (!meta?.capabilities.publish.supported) {\n  throw new BadRequestException(`${platform} cannot publish content`)\n}","typeGuard":"function supportsPublish(integration: PlatformIntegration): integration is PlatformIntegration & { publish: PublishProvider } {\n  return Boolean(integration.publish)\n}","tryCatchPattern":"try {\n  await publishService.publish(accountId, payload)\n} catch (e) {\n  if (e instanceof AppException && e.code === ResponseCode.ChannelPublishPlatformNotSupported) {\n    logger.warn(`Skipping publish for non-publishing platform ${e.details.platform}`)\n    return { skipped: true }\n  }\n  throw e\n}","preventionTips":["Filter account/publish-target lists by capabilities.publish.supported.","Never iterate all connected accounts with publish jobs unconditionally.","Surface 'publishing unavailable' in the UI instead of a generic error.","Check publishPolicy along with the publish provider when registering integrations."],"tags":["publish","platform-capability","unsupported-platform"],"backgroundTag":"platform-capability-not-supported","analyzedSha":"d3aa8bea5b146a8675607cf0144d891aad3e9683","analyzedAt":"2026-08-31T14:19:24.185Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}