yikart/AiToEarn · warning · AppException

ChannelPlatformOperationNotSupported

ChannelPlatformOperationNotSupported

Error message

ResponseCode.ChannelPlatformOperationNotSupported

What it means

BilibiliPublishOptionsProvider.getValues only supports the 'tid' field (archive category/type). Requesting values for any other publish-option field throws AppException ChannelPlatformOperationNotSupported with the platform and requested field in the context.

Source

Thrown at project/aitoearn-backend/apps/aitoearn-server/src/core/channels/platforms/bilibili/bilibili-publish-options.provider.ts:29

import { BilibiliService } from './bilibili.service'

@Injectable()
export class BilibiliPublishOptionsProvider implements PublishOptionSourceProvider {
  constructor(private readonly bilibiliService: BilibiliService) {}

  listSources() {
    return [{
      field: 'tid',
      label: 'Archive Type',
      description: 'Bilibili archive partition',
      valueType: PublishOptionValueType.Tree,
      requiresAccount: true,
    }]
  }

  async getValues(input: PublishOptionValuesInput): Promise<PublishOptionValuesResult> {
    if (input.field !== 'tid') {
      throw new AppException(ResponseCode.ChannelPlatformOperationNotSupported, {
        platform: AccountType.Bilibili,
        field: input.field,
      })
    }

    const archiveTypes = await this.bilibiliService.listArchiveTypes(input.credential.accessToken)
    return {
      field: 'tid',
      valueType: PublishOptionValueType.Tree,
      items: archiveTypes.map(item => this.toItem(item)),
    }
  }

  private toItem(item: BilibiliArchiveTypeItem): PublishOptionValueItem {
    const children = item.children?.map(child => ({
      value: String(child.id),
      label: child.name,
      description: child.description,

View on GitHub (pinned to d3aa8bea5b)

Solutions

  1. Only request field='tid' for Bilibili publish options; use listArchiveTypes data for category selection.
  2. Filter the publish-options field list per platform before querying getValues.
  3. If the field is needed, implement it in BilibiliPublishOptionsProvider (e.g. map to a Bilibili API).
  4. Catch this code and render the option as unsupported/hidden in the UI.

Example fix

// before
await provider.getValues({ credential, field: 'category' })

// after
await provider.getValues({ credential, field: 'tid' })
Defensive patterns

Strategy: validation

Validate before calling

const SUPPORTED_BILIBILI_FIELDS = ['tid']
if (!SUPPORTED_BILIBILI_FIELDS.includes(input.field)) {
  return { unsupported: true } // skip query / hide option in UI
}

Type guard

function isBilibiliPublishField(f: string): f is 'tid' {
  return f === 'tid'
}

Try / catch

try {
  values = await provider.getValues({ credential, field })
} catch (e) {
  if (e.code === 'ChannelPlatformOperationNotSupported') return null // render as unsupported
  throw e
}

Prevention

When it happens

Trigger: Calling getValues with input.field set to anything other than 'tid' (e.g. 'category', 'tags', 'area') for the Bilibili platform.

Common situations: Generic UI renders all publish-option fields across platforms and queries Bilibili for a field the adapter never implemented; field key renamed upstream; new option field added to the interface without a Bilibili implementation.

Related errors


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