yikart/AiToEarn · error · AppException

ResponseCode.ChannelAccountCreateNotSupported

ResponseCode.ChannelAccountCreateNotSupported

Error message

ChannelAccountCreateNotSupported

What it means

WeChatChannels account creation depends on an injected wechatService used to exchange loginCookie for auth data. If this.wechatService is not available (module not configured/registered in the current deployment), the service throws ChannelAccountCreateNotSupported — WeChat Channels connections are not supported in this environment.

Source

Thrown at project/aitoearn-backend/apps/aitoearn-server/src/core/channels/accounts/account.service.ts:493

    const normalizedData: NormalizedAccountCreateInput = {
      ...data,
      uid: data.uid,
      nickname: data.nickname,
    }
    if (normalizedData.type === AccountType.RedNote && normalizedData.clientType === undefined) {
      normalizedData.clientType = ClientType.WEB
    }
    return normalizedData
  }

  private async normalizeWeChatChannelsCreateInput(data: AccountCreateInput): Promise<NormalizedAccountCreateInput> {
    if (!data.loginCookie) {
      throw new AppException(ResponseCode.ChannelAccountCreateRequiredFieldMissing, {
        fields: ['loginCookie'],
      })
    }
    if (!this.wechatService) {
      throw new AppException(ResponseCode.ChannelAccountCreateNotSupported)
    }

    const authData = await this.wechatService.getChannelsAuthData(data.loginCookie)
    if (!authData.uid) {
      throw new AppException(ResponseCode.ChannelPlatformResponseInvalid)
    }
    if (data.uid && data.uid !== authData.uid) {
      throw new AppException(ResponseCode.ChannelPlatformResponseInvalid)
    }

    const normalizedData = { ...data }
    delete normalizedData.uid
    delete normalizedData.account
    delete (normalizedData as Record<string, unknown>)['channelId']

    return {
      ...normalizedData,
      uid: authData.uid,

View on GitHub (pinned to d3aa8bea5b)

Solutions

  1. Enable/register the WeChat service module for this deployment (check module wiring and env flags).
  2. Verify you are using the correct environment edition (China vs international) that supports WeChat Channels.
  3. If unsupported by design, use an alternative connection method or a different environment where WeChatChannels is supported.
  4. Confirm DI registration so this.wechatService is injected rather than undefined.

Example fix

// before
// module without WeChat provider imported
imports: [ChannelsModule]
// after
imports: [ChannelsModule, WechatServiceModule] // ensures wechatService is injected
Defensive patterns

Strategy: fallback

Validate before calling

// Check support before offering the flow
const wechatSupported = typeof wechatService !== 'undefined'
if (data.type === AccountType.WeChatChannels && !wechatSupported) {
  useAlternativeConnectionFlow(data) // or route to a supported environment
}

Type guard

function wechatChannelsSupported(env): boolean {
  return env.features?.wechatChannels === true
}

Try / catch

try {
  await createAccount(data)
} catch (e) {
  if (e instanceof AppException && e.code === ResponseCode.ChannelAccountCreateNotSupported) {
    // inform user WeChat Channels is unavailable in this environment; offer alternative
  } else throw e
}

Prevention

When it happens

Trigger: Creating a WeChatChannels account with a valid loginCookie in a deployment where the WeChat service module is absent or conditionally not registered (e.g. an edition/build without the WeChat integration enabled).

Common situations: Deploying without the WeChat service provider configured/enabled; feature flag or env var gating the WeChat module off; calling WeChatChannels creation against an environment that intentionally disables it.

Related errors


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