{"record":{"id":"9725c0802d452f6b","repo":"yikart/AiToEarn","slug":"responsecode-channelaccountcreatenotsupported","errorCode":"ResponseCode.ChannelAccountCreateNotSupported","errorMessage":"ChannelAccountCreateNotSupported","messagePattern":"ChannelAccountCreateNotSupported","errorType":"error_code","errorClass":"AppException","httpStatus":null,"severity":"error","filePath":"project/aitoearn-backend/apps/aitoearn-server/src/core/channels/accounts/account.service.ts","lineNumber":493,"sourceCode":"    const normalizedData: NormalizedAccountCreateInput = {\n      ...data,\n      uid: data.uid,\n      nickname: data.nickname,\n    }\n    if (normalizedData.type === AccountType.RedNote && normalizedData.clientType === undefined) {\n      normalizedData.clientType = ClientType.WEB\n    }\n    return normalizedData\n  }\n\n  private async normalizeWeChatChannelsCreateInput(data: AccountCreateInput): Promise<NormalizedAccountCreateInput> {\n    if (!data.loginCookie) {\n      throw new AppException(ResponseCode.ChannelAccountCreateRequiredFieldMissing, {\n        fields: ['loginCookie'],\n      })\n    }\n    if (!this.wechatService) {\n      throw new AppException(ResponseCode.ChannelAccountCreateNotSupported)\n    }\n\n    const authData = await this.wechatService.getChannelsAuthData(data.loginCookie)\n    if (!authData.uid) {\n      throw new AppException(ResponseCode.ChannelPlatformResponseInvalid)\n    }\n    if (data.uid && data.uid !== authData.uid) {\n      throw new AppException(ResponseCode.ChannelPlatformResponseInvalid)\n    }\n\n    const normalizedData = { ...data }\n    delete normalizedData.uid\n    delete normalizedData.account\n    delete (normalizedData as Record<string, unknown>)['channelId']\n\n    return {\n      ...normalizedData,\n      uid: authData.uid,","sourceCodeStart":475,"sourceCodeEnd":511,"githubUrl":"https://github.com/yikart/AiToEarn/blob/d3aa8bea5b146a8675607cf0144d891aad3e9683/project/aitoearn-backend/apps/aitoearn-server/src/core/channels/accounts/account.service.ts#L475-L511","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Enable/register the WeChat service module for this deployment (check module wiring and env flags).","Verify you are using the correct environment edition (China vs international) that supports WeChat Channels.","If unsupported by design, use an alternative connection method or a different environment where WeChatChannels is supported.","Confirm DI registration so this.wechatService is injected rather than undefined."],"exampleFix":"// before\n// module without WeChat provider imported\nimports: [ChannelsModule]\n// after\nimports: [ChannelsModule, WechatServiceModule] // ensures wechatService is injected","handlingStrategy":"fallback","validationCode":"// Check support before offering the flow\nconst wechatSupported = typeof wechatService !== 'undefined'\nif (data.type === AccountType.WeChatChannels && !wechatSupported) {\n  useAlternativeConnectionFlow(data) // or route to a supported environment\n}","typeGuard":"function wechatChannelsSupported(env): boolean {\n  return env.features?.wechatChannels === true\n}","tryCatchPattern":"try {\n  await createAccount(data)\n} catch (e) {\n  if (e instanceof AppException && e.code === ResponseCode.ChannelAccountCreateNotSupported) {\n    // inform user WeChat Channels is unavailable in this environment; offer alternative\n  } else throw e\n}","preventionTips":["Gate the WeChatChannels option in the UI by environment/feature flags.","Ensure the WeChat service module is registered where the feature is offered.","Verify China vs international edition support before exposing the flow.","Surface a clear 'not supported here' message instead of letting users hit the API."],"tags":["configuration","wechat-channels","unsupported"],"backgroundTag":"feature-not-supported-in-environment","analyzedSha":"d3aa8bea5b146a8675607cf0144d891aad3e9683","analyzedAt":"2026-08-31T14:19:24.185Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}