{"record":{"id":"2dab3b0ccb7c7b6c","repo":"conductor-oss/conductor","slug":"api-spec-exceeded-the-redirect-limit","errorCode":null,"errorMessage":"API spec exceeded the redirect limit","messagePattern":"API spec exceeded the redirect limit","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"agentspan/src/main/java/org/conductoross/conductor/ai/agentspan/runtime/service/ListApiToolsTask.java","lineNumber":269,"sourceCode":"            addHeaders(request, headers);\n            HttpResponse<byte[]> response =\n                    httpClient.send(request.build(), HttpResponse.BodyHandlers.ofByteArray());\n            if (response.statusCode() < 300 || response.statusCode() >= 400) {\n                return response;\n            }\n            String location = response.headers().firstValue(\"Location\").orElse(null);\n            if (location == null) {\n                throw new IllegalArgumentException(\n                        \"API spec redirect is missing a Location header\");\n            }\n            String target = URI.create(currentUrl).resolve(location).toString();\n            if (hasSensitiveHeaders(headers) && !isSameOrigin(currentUrl, target)) {\n                throw new IllegalArgumentException(\n                        \"Refusing to forward credentials across an API spec redirect\");\n            }\n            currentUrl = target;\n        }\n        throw new IllegalArgumentException(\"API spec exceeded the redirect limit\");\n    }\n\n    private void addHeaders(HttpRequest.Builder builder, Map<String, String> headers) {\n        if (headers == null) {\n            return;\n        }\n        headers.forEach(\n                (name, value) -> {\n                    if (name == null\n                            || value == null\n                            || name.indexOf('\\r') >= 0\n                            || name.indexOf('\\n') >= 0\n                            || value.indexOf('\\r') >= 0\n                            || value.indexOf('\\n') >= 0) {\n                        throw new IllegalArgumentException(\n                                \"API spec headers must not contain CR or LF characters\");\n                    }\n                    builder.header(name, value);","sourceCodeStart":251,"sourceCodeEnd":287,"githubUrl":"https://github.com/conductor-oss/conductor/blob/cf7c3e4a8adfb158be778ab1ec525323c363cd3a/agentspan/src/main/java/org/conductoross/conductor/ai/agentspan/runtime/service/ListApiToolsTask.java#L251-L287","documentation":"Error \"API spec exceeded the redirect limit\" thrown in conductor-oss/conductor.","triggerScenarios":"Thrown at agentspan/src/main/java/org/conductoross/conductor/ai/agentspan/runtime/service/ListApiToolsTask.java:269 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Point the API spec URL directly at the final location to avoid redirect chains.","Check the hosting server for a redirect loop."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"cf7c3e4a8adfb158be778ab1ec525323c363cd3a","analyzedAt":"2026-08-14T03:33:19.897Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}