SubtitleEdit/subtitleedit · error · InvalidOperationException

DashScope transcription task {status}. Response: {json}

Error message

DashScope transcription task {status}. Response: {json}

What it means

Thrown when the polled task status is FAILED or UNKNOWN (case-insensitive). The task did not succeed — DashScope explicitly reported failure or returned an unrecognized status string. The full JSON response is included for diagnosis. QUEUED/PENDING/PROCESSING statuses fall through to the default case and continue polling.

Source

Thrown at src/ui/Features/Video/SpeechToText/DashScope/DashScopeSttService.cs:226

                throw new HttpRequestException($"DashScope task poll failed ({(int)response.StatusCode}). Response: {json}");
            }

            var output = JsonSerializer.Deserialize<DashScopeTaskResponse>(json, options)?.Output;
            var status = output?.TaskStatus ?? "UNKNOWN";
            switch (status.ToUpperInvariant())
            {
                case "SUCCEEDED":
                    var transcriptionUrl = output?.Result?.TranscriptionUrl
                        ?? (output?.Results != null && output.Results.Count > 0 ? output.Results[0].TranscriptionUrl : null);
                    if (string.IsNullOrEmpty(transcriptionUrl))
                    {
                        throw new InvalidOperationException($"DashScope task succeeded but returned no transcription_url. Response: {json}");
                    }
                    return transcriptionUrl;

                case "FAILED":
                case "UNKNOWN":
                    throw new InvalidOperationException($"DashScope transcription task {status}. Response: {json}");

                default: // QUEUED, PENDING, PROCESSING
                    await Task.Delay(TimeSpan.FromSeconds(3), ct);
                    break;
            }
        }
    }

    /// <summary>
    /// Serialize the async submit body. <c>enable_words</c> adds word-level
    /// timings; a fixed language is sent only when the user set one.
    /// </summary>
    internal static string BuildSubmitBody(DashScopeSttSettings settings, string fileUrl, string? language)
    {
        var languageToUse = language ?? settings.Language;

        using var stream = new MemoryStream();
        using (var writer = new Utf8JsonWriter(stream))

View on GitHub (pinned to 17a9f07487)

Solutions

  1. Examine the json response body for DashScope's error details (error_message, error_code fields).
  2. Verify the audio file is valid and in a supported format (WAV, MP3, FLAC, etc. — check DashScope ASR docs).
  3. Check the audio file's sample rate and bitrate are within the model's supported range.
  4. If the audio is very short, pad it or use a different model that handles short clips.
  5. Re-encode the audio to a standard format (16kHz mono WAV) and retry.
  6. For UNKNOWN status, check if the response uses a new status string not in the switch cases.
Defensive patterns

Strategy: try-catch

Validate before calling

// Pre-validate audio format before submitting to DashScope
var info = GetAudioInfo(audioFilePath);
if (info.Duration.TotalSeconds < 0.5)
    throw new InvalidOperationException("Audio is too short for transcription (minimum 0.5 seconds).");
if (!SupportedFormats.Contains(info.Container))
    throw new InvalidOperationException($"Audio format '{info.Container}' may not be supported by DashScope ASR.");

Try / catch

try { var result = await service.TranscribeAsync(path, lang, progress, segProgress, ct); }
catch (InvalidOperationException ex) when (ex.Message.Contains("transcription task FAILED") || ex.Message.Contains("UNKNOWN"))
{ /* parse JSON for error details, re-encode audio, or switch model */ }

Prevention

When it happens

Trigger: The ASR engine encountered an error processing the audio (corrupt audio, unsupported codec, audio too short); the task was killed by DashScope's internal timeout; the model encountered an internal error; an UNKNOWN status from an unrecognized response field.

Common situations: The uploaded audio file is corrupt or in an unsupported format; the audio is too short (below minimum duration); the model crashed server-side; the audio bitrate/sample rate is outside the model's supported range; the task exceeded DashScope's maximum processing time.

Related errors


AI-assisted analysis of SubtitleEdit/subtitleedit@17a9f07487 (2026-08-13). Data as JSON: /api/errors/8791bf537d5306e9. Report an issue: GitHub.