{"record":{"id":"4658f7d748cc92ff","repo":"SubtitleEdit/subtitleedit","slug":"dashscope-async-submit-failed-int-response-stat","errorCode":null,"errorMessage":"DashScope async submit failed ({(int)response.StatusCode}). Response: {json}","messagePattern":"DashScope async submit failed \\((.+?)\\)\\. Response: (.+?)","errorType":"http","errorClass":"HttpRequestException","httpStatus":null,"severity":"error","filePath":"src/ui/Features/Video/SpeechToText/DashScope/DashScopeSttService.cs","lineNumber":179,"sourceCode":"\n    private async Task<string> SubmitTaskAsync(string ossUrl, string? language, CancellationToken ct)\n    {\n        var body = BuildSubmitBody(_settings, ossUrl, language);\n        using var content = new StringContent(body, Encoding.UTF8, \"application/json\");\n        using var request = new HttpRequestMessage(HttpMethod.Post, BaseUrl + TranscriptionPath)\n        {\n            Content = content,\n        };\n        request.Headers.Authorization = new AuthenticationHeaderValue(\"Bearer\", _settings.ApiKey);\n        request.Headers.TryAddWithoutValidation(\"X-DashScope-Async\", \"enable\");\n        request.Headers.TryAddWithoutValidation(\"X-DashScope-OssResourceResolve\", \"enable\");\n\n        using var response = await _httpClient.SendAsync(request, HttpCompletionOption.ResponseHeadersRead, ct);\n        var json = await response.Content.ReadAsStringAsync(ct);\n        if (!response.IsSuccessStatusCode)\n        {\n            _settings.Logger?.Invoke($\"DashScope async submit failed ({(int)response.StatusCode}): {json}\");\n            throw new HttpRequestException($\"DashScope async submit failed ({(int)response.StatusCode}). Response: {json}\");\n        }\n\n        var taskId = JsonSerializer.Deserialize<DashScopeTaskResponse>(json,\n            new JsonSerializerOptions { PropertyNameCaseInsensitive = true })?.Output?.TaskId;\n        if (string.IsNullOrEmpty(taskId))\n        {\n            throw new InvalidOperationException($\"DashScope async submit returned no task_id. Response: {json}\");\n        }\n\n        return taskId;\n    }\n\n    private async Task<string> PollTaskAsync(string taskId, CancellationToken ct)\n    {\n        var url = BaseUrl + TasksPath + Uri.EscapeDataString(taskId);\n        var options = new JsonSerializerOptions { PropertyNameCaseInsensitive = true };\n\n        while (true)","sourceCodeStart":161,"sourceCodeEnd":197,"githubUrl":"https://github.com/SubtitleEdit/subtitleedit/blob/17a9f0748781032255db3526b7215d2fb891e3af/src/ui/Features/Video/SpeechToText/DashScope/DashScopeSttService.cs#L161-L197","documentation":"Thrown when the POST to DashScope's async transcription submit endpoint (/api/v1/services/audio/asr/transcription) returns a non-success HTTP status. This is the step that creates the transcription job using the oss:// URL from the upload. The request includes X-DashScope-Async and X-DashScope-OssResourceResolve headers.","triggerScenarios":"The API key lacks ASR permissions; the oss:// URL is malformed or expired; the request body (BuildSubmitBody) has invalid parameters (bad model, unsupported language, invalid parameter combination); the DashScope service is temporarily unavailable.","commonSituations":"The ASR model specified in settings is deprecated or not available in the region; the oss:// URL expired because too much time passed between upload and submit; the language code format is wrong; the request body JSON has an unexpected field; rate limiting.","solutions":["Examine the json response body in the error for DashScope's specific error code and message.","Verify the model name in _settings.Model is valid and available (default: 'qwen3-asr-flash-filetrans').","If the submit happens long after upload, the oss:// URL may have expired — reduce processing time or re-upload.","Check for rate limiting (429) and implement backoff if submitting many files.","Validate the language parameter format matches DashScope's expectations."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Validate the oss URL format before submitting\nif (string.IsNullOrWhiteSpace(ossUrl) || !ossUrl.StartsWith(\"oss://\"))\n    throw new InvalidOperationException($\"Invalid OSS URL for submission: {ossUrl}\");","typeGuard":null,"tryCatchPattern":"try { var taskId = await SubmitTaskAsync(ossUrl, language, ct); }\ncatch (HttpRequestException ex) when (ex.Message.Contains(\"async submit failed\"))\n{\n    var code = ExtractStatusCode(ex.Message);\n    if (code == 429) /* rate limited, backoff and retry */;\n    else if (code == 400) /* check model/language parameters in body */;\n}","preventionTips":["Verify the model name in settings is valid for the selected region.","Submit the transcription immediately after upload to avoid oss:// URL expiry.","Implement rate-limit handling (429) with exponential backoff.","Validate the language parameter matches DashScope's expected format."],"tags":["network","http","dashscope","speech-to-text","api-error"],"backgroundTag":null,"analyzedSha":"17a9f0748781032255db3526b7215d2fb891e3af","analyzedAt":"2026-08-13T18:11:43.374Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}