SubtitleEdit/subtitleedit · error · InvalidOperationException
DashScope async submit returned no task_id. Response: {json}
Error message
DashScope async submit returned no task_id. Response: {json} What it means
Thrown when the async submit endpoint returns HTTP 200 but the deserialized response's Output.TaskId is null or empty. The response was successfully received and parsed, but the expected task_id field is missing, indicating the API accepted the request but didn't return a trackable task identifier.
Source
Thrown at src/ui/Features/Video/SpeechToText/DashScope/DashScopeSttService.cs:186
Content = content,
};
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", _settings.ApiKey);
request.Headers.TryAddWithoutValidation("X-DashScope-Async", "enable");
request.Headers.TryAddWithoutValidation("X-DashScope-OssResourceResolve", "enable");
using var response = await _httpClient.SendAsync(request, HttpCompletionOption.ResponseHeadersRead, ct);
var json = await response.Content.ReadAsStringAsync(ct);
if (!response.IsSuccessStatusCode)
{
_settings.Logger?.Invoke($"DashScope async submit failed ({(int)response.StatusCode}): {json}");
throw new HttpRequestException($"DashScope async submit failed ({(int)response.StatusCode}). Response: {json}");
}
var taskId = JsonSerializer.Deserialize<DashScopeTaskResponse>(json,
new JsonSerializerOptions { PropertyNameCaseInsensitive = true })?.Output?.TaskId;
if (string.IsNullOrEmpty(taskId))
{
throw new InvalidOperationException($"DashScope async submit returned no task_id. Response: {json}");
}
return taskId;
}
private async Task<string> PollTaskAsync(string taskId, CancellationToken ct)
{
var url = BaseUrl + TasksPath + Uri.EscapeDataString(taskId);
var options = new JsonSerializerOptions { PropertyNameCaseInsensitive = true };
while (true)
{
ct.ThrowIfCancellationRequested();
using var request = new HttpRequestMessage(HttpMethod.Get, url);
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", _settings.ApiKey);
using var response = await _httpClient.SendAsync(request, HttpCompletionOption.ResponseHeadersRead, ct);View on GitHub (pinned to 17a9f07487)
Solutions
- Inspect the raw json in the error message to see the actual response structure.
- If the structure changed, update DashScopeTaskResponse and its nested Output class to match.
- Check if the response contains an error/status field that explains why no task was created.
- Verify PropertyNameCaseInsensitive is correctly mapping 'task_id' to TaskId — test with a known-good response.
Defensive patterns
Strategy: try-catch
Validate before calling
// Check for known error fields before deserializing task_id
using var doc = JsonDocument.Parse(json);
if (doc.RootElement.TryGetProperty("output", out var output) &&
output.TryGetProperty("task_id", out var taskIdProp) &&
taskIdProp.ValueKind == JsonValueKind.String)
{ /* safe to deserialize normally */ }
else
throw new InvalidOperationException($"Response lacks output.task_id. Raw: {json}"); Try / catch
try { var taskId = DeserializeTaskId(json); }
catch (InvalidOperationException ex) when (ex.Message.Contains("no task_id"))
{ /* log raw JSON, check for business error in response, surface to user */ } Prevention
- Log the raw JSON for any missing-field error.
- Pin to a known DashScope API version if versioning is available.
- Check the response for error/status fields that explain the missing task_id.
- Monitor DashScope changelog for response envelope changes.
When it happens
Trigger: The response JSON has a different structure than DashScopeTaskResponse expects (Output or TaskId at a different nesting level); the API returned a 200 with a business-level error that doesn't populate TaskId; PropertyNameCaseInsensitive deserialization mapped incorrectly.
Common situations: DashScope changed the response envelope structure; the response contains an error object at the top level instead of the expected output.task_id path; a field rename (e.g. task_id vs taskId vs id) that case-insensitive matching doesn't bridge.
Related errors
- DashScope upload-policy response could not be parsed. Respon
- DashScope task succeeded but returned no transcription_url.
- DashScope transcription timed out after {_settings.TimeoutSe
- DashScope upload-policy request failed ({(int)policyResponse
- DashScope OSS upload failed ({(int)uploadResponse.StatusCode
AI-assisted analysis of SubtitleEdit/subtitleedit@17a9f07487 (2026-08-13).
Data as JSON: /api/errors/abb578fbd405da5b.
Report an issue: GitHub.