CherryHQ/cherry-studio · error · ModelscopeTaskFailedError
result.message || 'Task failed'
Error message
result.message || 'Task failed'
What it means
Thrown as a `ModelscopeTaskFailedError` during polling when `task_status === 'FAILED'`. The message is the vendor-provided `result.message` if present, otherwise a generic `'Task failed'`. This is a terminal condition — the ModelScope async image task will not produce output images.
Source
Thrown at src/main/ai/provider/custom/modelscope/modelscopeTransport.ts:156
throw createAbortError('Task polling aborted')
}
try {
const result = await this.request<ModelscopeTaskResult>(
`/v1/tasks/${encodeURIComponent(taskId)}`,
'GET',
undefined,
{
timeout: 10000,
signal,
extraHeaders: { 'X-ModelScope-Task-Type': 'image_generation' }
}
)
transientRetries = 0
if (result.task_status === 'SUCCEED') return result
if (result.task_status === 'FAILED') {
throw new ModelscopeTaskFailedError(result.message || 'Task failed')
}
} catch (error) {
if (signal?.aborted || (error instanceof Error && error.name === 'AbortError')) {
throw createAbortError('Task polling aborted')
}
// Terminal failure or a 4xx (bar 429) poll response ends the loop;
// 5xx / 429 fall through to transient retry.
if (error instanceof ModelscopeTaskFailedError) {
throw error
}
if (error instanceof ModelscopeApiError && isTerminalHttpStatus(error.statusCode)) {
throw error
}
transientRetries++
if (transientRetries >= maxTransientRetries) {
throw error instanceof Error ? error : new Error(String(error))
}View on GitHub (pinned to 726446b54c)
Solutions
- Inspect the error message (vendor `result.message`) for the specific failure reason and adjust parameters.
- Retry — content-moderation and some quota failures are per-request.
- Verify the model id and parameter ranges against the api-inference docs.
Defensive patterns
Strategy: try-catch
Type guard
const isModelscopeTaskFailedError = (e: unknown): e is ModelscopeTaskFailedError => e instanceof Error && e.name === 'ModelscopeTaskFailedError'
Try / catch
try {
urls = await transport.poll(taskId, { signal })
} catch (e) {
if (e instanceof ModelscopeTaskFailedError) {
// terminal vendor failure — surface e.message to the user
throw new Error(`Image generation failed: ${e.message}`)
}
throw e
} Prevention
- Surface the vendor message so the user can adjust params
- Validate numInferenceSteps/guidanceScale ranges against the model docs
- Retry once for per-request moderation/quota edge cases
When it happens
Trigger: The ModelScope async image task failed on the vendor side: content-moderation rejection, invalid generation parameters (steps/guidance/size out of range), free-tier quota exhaustion, or an unsupported model.
Common situations: Prompt tripped ModelScope's content filter; `numInferenceSteps`/`guidanceScale` outside the model's accepted range; free-tier fair-use quota hit; the requested model id is not enabled.
Related errors
- DashScope task ${status.toLowerCase()}
- Task polling timeout
- Task polling timeout
- Rerank response must contain a results array
- Feishu app registration timed out
AI-assisted analysis of CherryHQ/cherry-studio@726446b54c (2026-08-12).
Data as JSON: /api/errors/e9a6db5c9e2f6d45.
Report an issue: GitHub.