{"record":{"id":"9db0e43d39e64717","repo":"vxcontrol/pentagi","slug":"failed-to-do-request-v-9db0e4","errorCode":null,"errorMessage":"failed to do request: %v","messagePattern":"failed to do request: (.+?)","errorType":"exception","errorClass":"Retryable","httpStatus":null,"severity":"error","filePath":"backend/pkg/tools/searchers/traversaal.go","lineNumber":97,"sourceCode":"\t}{\n\t\tQuery: query,\n\t})\n\tif err != nil {\n\t\treturn \"\", Fatal(fmt.Errorf(\"failed to marshal request body: %v\", err))\n\t}\n\n\treq, err := http.NewRequest(http.MethodPost, traversaalURL, bytes.NewBuffer(reqBody))\n\tif err != nil {\n\t\treturn \"\", Fatal(fmt.Errorf(\"failed to build request: %v\", err))\n\t}\n\n\treq = req.WithContext(ctx)\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\treq.Header.Set(\"x-api-key\", t.apiKey())\n\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn \"\", Retryable(fmt.Errorf(\"failed to do request: %v\", err), 0)\n\t}\n\tdefer resp.Body.Close()\n\n\treturn t.parseHTTPResponse(resp)\n}\n\nfunc (t *traversaal) parseHTTPResponse(resp *http.Response) (string, error) {\n\tif resp.StatusCode != http.StatusOK {\n\t\terr := fmt.Errorf(\"unexpected status code: %d\", resp.StatusCode)\n\t\tif resp.StatusCode == http.StatusTooManyRequests || resp.StatusCode >= 500 {\n\t\t\treturn \"\", Retryable(err, 0)\n\t\t}\n\t\treturn \"\", Fatal(err)\n\t}\n\tvar respBody struct {\n\t\tData traversaalSearchResult `json:\"data\"`\n\t}\n\tif err := json.NewDecoder(resp.Body).Decode(&respBody); err != nil {","sourceCodeStart":79,"sourceCodeEnd":115,"githubUrl":"https://github.com/vxcontrol/pentagi/blob/ea665308baaff015b226f308438a68d929d0f29b/backend/pkg/tools/searchers/traversaal.go#L79-L115","documentation":"traversaal.search returns a Retryable error 'failed to do request: %v' when client.Do(req) fails — the HTTP round trip itself did not complete: DNS failure, connection refused/reset, TLS handshake error, or context cancellation/timeout. It is classified Retryable so the orchestrator may retry or fall back to another engine.","triggerScenarios":"client.Do(req) returns err in search() — network unreachable, DNS resolution failure for the Traversaal host, TLS errors, or the request context (ctx) was canceled/timed out by the caller.","commonSituations":"No outbound internet/DNS in the Docker container; corporate proxy blocking api.traversaal.ai; ctx deadline exceeded under slow agent pipelines; TLS interception with unknown CA.","solutions":["Check network egress/DNS from the backend container (e.g. curl the Traversaal endpoint from inside).","Inspect the wrapped error: 'context deadline exceeded' means raise the caller timeout; 'connection refused' means egress/proxy blocking.","Configure a valid HTTP(S) proxy or add the proxy CA to the trust store if traffic is intercepted.","Rely on Retryable classification to fall back to another engine in the web_search fallbackStrategy."],"exampleFix":"// before: unbounded caller context\nctx := context.Background()\n// after: bounded, cancellation-aware context\nctx, cancel := context.WithTimeout(ctx, 15*time.Second)\ndefer cancel()","handlingStrategy":"retry","validationCode":"if err := ctx.Err(); err != nil {\n    return fmt.Errorf(\"context already done, skipping search: %w\", err)\n}","typeGuard":"func isRetryable(err error) bool {\n    var r *searchers.RetryableError\n    return errors.As(err, &r)\n}","tryCatchPattern":"result, err := traversaalSearcher.Handle(ctx, req)\nif err != nil {\n    if errors.Is(err, context.DeadlineExceeded) {\n        return \"\", fmt.Errorf(\"traversaal timed out; raise caller timeout\")\n    }\n    if isRetryable(err) {\n        return fallbackEngine.Handle(ctx, req)\n    }\n    return \"\", err\n}","preventionTips":["Verify outbound DNS and egress from the deployment container","Use bounded contexts with timeouts appropriate for remote search APIs","Trust proxy/TLS configuration before enabling remote searchers"],"tags":["network","http","traversaal","dns","timeout"],"backgroundTag":"http-request-failed","analyzedSha":"ea665308baaff015b226f308438a68d929d0f29b","analyzedAt":"2026-09-01T14:16:31.421Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}