yikart/AiToEarn · error · Error

该平台在当前区域不可用

Error message

该平台在当前区域不可用

What it means

The web app's plugin publish flow refuses to publish to a platform that is disabled for the user's current region. Before doing any work, publish() checks isPlatformEnabledSync(platform); if the platform is region-restricted it throws PLATFORM_REGION_RESTRICTED ("该平台在当前区域不可用"). This is a deliberate policy guard, typically reflecting compliance/licensing restrictions (e.g. 中国版 vs 国际版 environments).

Source

Thrown at project/aitoearn-web/src/store/plugin/store.ts:757

          set({
            platformAccounts: { ...platformAccounts, [platform]: result },
          })
          await methods.syncAccountToDatabase(platform)
          return result
        }
        catch (error) {
          console.error('登录失败:', error)
          throw error
        }
      },

      /** 发布内容到指定平台 */
      async publish(params: PublishParams, onProgress?: ProgressCallback) {
        const { status, publishingPlatforms, platformProgress } = get()
        const platform = params.platform

        if (!isPlatformEnabledSync(platform))
          throw new Error(ERROR_MESSAGES.PLATFORM_REGION_RESTRICTED)

        // 解析话题
        const { topics, cleanedString } = parseTopicString(params.desc || '')
        params.topics = [...new Set(params.topics?.concat(topics))]
        params.desc = cleanedString

        const accountId = params.accountId
        // 使用 platform + accountId 作为唯一标识,支持同一平台多账号同时发布
        const publishKey = getPublishKey(platform, accountId)

        if (status === Status.NOT_INSTALLED)
          throw new Error(ERROR_MESSAGES.PLUGIN_NOT_INSTALLED)

        if (status !== Status.READY)
          throw new Error(ERROR_MESSAGES.PLUGIN_NOT_READY)

        // 检查该账号是否正在发布(同一平台不同账号可以同时发布)
        if (publishingPlatforms.has(publishKey))

View on GitHub (pinned to d3aa8bea5b)

Solutions

  1. Check isPlatformEnabledSync(params.platform) in the UI before offering/enabling the publish action, and hide or disable restricted platforms
  2. Verify the current environment/region build (aitoearn.cn vs aitoearn.ai) matches the platforms the user expects; switch environment or platform accordingly
  3. If the platform should be available, update the region/platform enablement config so isPlatformEnabledSync returns true

Example fix

// before
await publish({ platform: 'xiaohongshu', accountId }) // throws if restricted
// after
if (isPlatformEnabledSync('xiaohongshu')) {
  await publish({ platform: 'xiaohongshu', accountId })
} else {
  toast.error('该平台在当前区域不可用')
}
Defensive patterns

Strategy: validation

Validate before calling

import { isPlatformEnabledSync } from '@/lib/platforms'
const { publish } = usePluginStore.getState()
if (!isPlatformEnabledSync(platform)) {
  toast.error('该平台在当前区域不可用'); return
}
await publish({ platform, accountId })

Type guard

function isPublishablePlatform(p: string): boolean {
  return isPlatformEnabledSync(p)
}

Try / catch

try {
  await publish({ platform, accountId })
} catch (e) {
  if (e.message === '该平台在当前区域不可用') {
    toast.error('该平台在当前区域不可用'); return
  }
  throw e
}

Prevention

When it happens

Trigger: Calling publish({ platform, ... }) from project/aitoearn-web/src/store/plugin/store.ts with a platform for which isPlatformEnabledSync returns false — i.e. the platform is not enabled in the current region/environment build.

Common situations: Users of the international build (aitoearn.ai) trying to publish to China-only platforms (or vice versa with aitoearn.cn), or a platform gated behind a feature flag/region config that hasn't been enabled for the deployed environment.

Related errors


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