{"record":{"id":"f49eef722bb61bbf","repo":"chenhg5/cc-connect","slug":"qwen-asr-request-w","errorCode":null,"errorMessage":"qwen asr request: %w","messagePattern":"qwen asr request: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/speech.go","lineNumber":173,"sourceCode":"\t\t},\n\t}\n\n\tjsonData, err := json.Marshal(reqBody)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"marshal request: %w\", err)\n\t}\n\n\turl := q.BaseURL + \"/chat/completions\"\n\treq, err := http.NewRequestWithContext(ctx, http.MethodPost, url, bytes.NewReader(jsonData))\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"create request: %w\", err)\n\t}\n\treq.Header.Set(\"Authorization\", \"Bearer \"+q.APIKey)\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\n\tresp, err := q.Client.Do(req)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"qwen asr request: %w\", err)\n\t}\n\tdefer resp.Body.Close()\n\n\tbody, err := io.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"read response: %w\", err)\n\t}\n\n\tif resp.StatusCode != http.StatusOK {\n\t\treturn \"\", fmt.Errorf(\"qwen asr API %d: %s\", resp.StatusCode, string(body))\n\t}\n\n\tvar result struct {\n\t\tChoices []struct {\n\t\t\tMessage struct {\n\t\t\t\tContent string `json:\"content\"`\n\t\t\t} `json:\"message\"`\n\t\t} `json:\"choices\"`","sourceCodeStart":155,"sourceCodeEnd":191,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/core/speech.go#L155-L191","documentation":"The HTTP POST to the Qwen ASR chat/completions endpoint failed at the transport level. Wrapped causes include DNS failure, connection refused, TLS errors, proxy interference, the 5-minute client timeout, or context cancellation.","triggerScenarios":"Transcribe called when the DashScope endpoint is unreachable (no network, wrong base_url host/port, blocked region, TLS interception), when the request exceeds the 5-minute timeout, or when ctx is cancelled.","commonSituations":"Deployments outside mainland China hitting DashScope connectivity issues; corporate proxy/firewall blocking dashscope.aliyuncs.com; typo'd custom gateway URL pointing to a dead host; long audio making the request exceed timeouts.","solutions":["Verify the endpoint is reachable: curl https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions","Check proxy/firewall/region restrictions for DashScope access","If the wrapped error is a timeout, shorten audio or raise the http.Client timeout","Confirm the custom base_url host/port if using a gateway"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// verify reachability before use\nresp, err := http.Head(q.BaseURL)\nif err != nil {\n    return fmt.Errorf(\"dashscope endpoint unreachable: %w\", err)\n}\nresp.Body.Close()","typeGuard":null,"tryCatchPattern":"var netErr net.Error\nif errors.As(err, &netErr) && netErr.Timeout() {\n    // shorten audio or raise client timeout, then retry\n}\nif errors.Is(err, context.Canceled) {\n    // caller cancelled; do not retry\n}","preventionTips":["Confirm DashScope reachability from your deployment region/network","Configure HTTPS_PROXY where corporate egress is required","Retry transient transport errors with backoff","Check gateway host/port when overriding base_url"],"tags":["network","http","qwen","timeout"],"backgroundTag":"network-request-failed","analyzedSha":"4000b2338aa6e850c99df54f8b0ed6ed7460b401","analyzedAt":"2026-09-06T11:45:09.575Z","contentChangedAt":"2026-09-06T11:45:09.575Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}