CherryHQ/cherry-studio · error · Error

Task polling timeout

Error message

Task polling timeout

What it means

Thrown by `ModelscopeTransport.pollTaskResult` after exceeding `maxAttempts` (default 120) polls without the task reaching `SUCCEED`. The poll interval scales from 3s (first 60s) to 10s, giving a default budget of roughly 15–20 minutes. This is budget exhaustion, not a vendor-side failure.

Source

Thrown at src/main/ai/provider/custom/modelscope/modelscopeTransport.ts:187

        }

        transientRetries++
        if (transientRetries >= maxTransientRetries) {
          throw error instanceof Error ? error : new Error(String(error))
        }
        const elapsedTime = Date.now() - startTime
        const pollDelay = interval ?? (elapsedTime < 60000 ? 3000 : 10000)
        await waitWithSignal(pollDelay, signal)
        continue
      }

      const elapsedTime = Date.now() - startTime
      const pollDelay = interval ?? (elapsedTime < 60000 ? 3000 : 10000)
      await waitWithSignal(pollDelay, signal)
      attempts++
    }

    throw new Error('Task polling timeout')
  }

  private async request<T>(
    path: string,
    method: 'POST' | 'GET',
    body: Record<string, unknown> | undefined,
    options: { timeout?: number; signal?: AbortSignal; extraHeaders?: Record<string, string> }
  ): Promise<T> {
    const timeout = options.timeout ?? DEFAULT_TIMEOUT
    const externalSignal = options.signal
    const controller = new AbortController()
    let externallyAborted = false

    const timeoutId = setTimeout(() => controller.abort(), timeout)
    const onExternalAbort = () => {
      externallyAborted = true
      controller.abort()
    }

View on GitHub (pinned to 726446b54c)

Solutions

  1. Increase `maxAttempts` / `interval` in the poll options to extend the budget for slow models.
  2. Check network connectivity to `api-inference.modelscope.cn` and retry.
  3. If tasks are consistently stuck at PENDING, verify the model is available and the account is not rate-limited.
Defensive patterns

Strategy: retry

Validate before calling

const POLL_OPTIONS = { maxAttempts: 180, interval: 5000 } // extend budget for slow models

Try / catch

try {
  urls = await transport.poll(taskId, { ...opts, maxAttempts: 180 })
} catch (e) {
  if (e instanceof Error && e.message === 'Task polling timeout') {
    // resubmit or surface a 'generation is taking too long' message
  }
  throw e
}

Prevention

When it happens

Trigger: A ModelScope async image task that never completes within the polling window: a slow model under load, a stuck PENDING/RUNNING task, or repeated transient poll failures consuming retries without progress.

Common situations: Heavy model under vendor load; network latency inflating poll round-trips; free-tier queuing behind other tasks; repeated 5xx/429 polls using up transient retries.

Understand the failure class

Related errors


AI-assisted analysis of CherryHQ/cherry-studio@726446b54c (2026-08-12). Data as JSON: /api/errors/6621f87aed18bd5c. Report an issue: GitHub.