yikart/AiToEarn · warning · Error

${platform} 当前正在发布中,请稍后再试

Error message

${platform} 当前正在发布中,请稍后再试

What it means

publish() serializes publishing per platform+account via a publishingPlatforms Set keyed by getPublishKey(platform, accountId). If the same account on the same platform already has an in-flight publish, it throws `${platform} ${ERROR_MESSAGES.PUBLISHING_IN_PROGRESS}` to prevent concurrent publishes to one account.

Source

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

        // 解析话题
        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))
          throw new Error(`${platform} ${ERROR_MESSAGES.PUBLISHING_IN_PROGRESS}`)

        // 标记该账号正在发布,并初始化进度
        const newPublishingPlatforms = new Set(publishingPlatforms)
        newPublishingPlatforms.add(publishKey)
        const newPlatformProgress = new Map(platformProgress)
        const initialProgress: ProgressEvent = {
          stage: 'download',
          progress: 0,
          message: '准备发布...',
          timestamp: Date.now(),
        }
        newPlatformProgress.set(publishKey, initialProgress)

        set({
          isPublishing: newPublishingPlatforms.size > 0,
          publishingPlatforms: newPublishingPlatforms,
          publishProgress: initialProgress,
          platformProgress: newPlatformProgress,

View on GitHub (pinned to d3aa8bea5b)

Solutions

  1. Disable the publish button while publishingPlatforms.has(publishKey) and re-enable on completion
  2. Wait for the current publish to finish (its onProgress callback reaching completion) before retrying
  3. If a previous publish crashed and left the key stuck, reset the plugin store / reload the page to clear publishingPlatforms

Example fix

// before
onClick={() => publish({ platform, accountId })}
// after
const key = getPublishKey(platform, accountId)
const { publishingPlatforms } = usePluginStore.getState()
if (publishingPlatforms.has(key)) return
onClick={() => publish({ platform, accountId })} // button also disabled while publishing
Defensive patterns

Strategy: validation

Validate before calling

const key = getPublishKey(platform, accountId)
const { publishingPlatforms } = usePluginStore.getState()
if (publishingPlatforms.has(key)) return // already publishing
await publish({ platform, accountId })

Type guard

function isPublishKeyBusy(key: string, set: Set<string>): boolean {
  return set.has(key)
}

Try / catch

try {
  await publish({ platform, accountId })
} catch (e) {
  if (e.message.includes('当前正在发布中')) {
    toast.info('该账号正在发布中,请稍后再试'); return
  }
  throw e
}

Prevention

When it happens

Trigger: Calling publish() twice with the same platform and accountId while the first publish is still running (publishingPlatforms still contains the publishKey).

Common situations: Double-clicking the publish button, retrying while a slow upload/progress loop is still active, or a previous publish that crashed without releasing the publishKey from the set.

Related errors


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