{"record":{"id":"0e32ee04f439de24","repo":"conductor-oss/conductor","slug":"api-spec-redirect-is-missing-a-location-header","errorCode":null,"errorMessage":"API spec redirect is missing a Location header","messagePattern":"API spec redirect is missing a Location header","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"agentspan/src/main/java/org/conductoross/conductor/ai/agentspan/runtime/service/ListApiToolsTask.java","lineNumber":259,"sourceCode":"    /** Follows a bounded redirect chain only after each destination passes the outbound policy. */\n    private HttpResponse<byte[]> sendWithValidatedRedirects(String url, Map<String, String> headers)\n            throws Exception {\n        String currentUrl = url;\n        for (int redirects = 0; redirects <= 5; redirects++) {\n            HttpRequest.Builder request =\n                    HttpRequest.newBuilder()\n                            .uri(URI.create(currentUrl))\n                            .timeout(REQUEST_TIMEOUT)\n                            .GET();\n            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) -> {","sourceCodeStart":241,"sourceCodeEnd":277,"githubUrl":"https://github.com/conductor-oss/conductor/blob/cf7c3e4a8adfb158be778ab1ec525323c363cd3a/agentspan/src/main/java/org/conductoross/conductor/ai/agentspan/runtime/service/ListApiToolsTask.java#L241-L277","documentation":"Error \"API spec redirect is missing a Location header\" thrown in conductor-oss/conductor.","triggerScenarios":"Thrown at agentspan/src/main/java/org/conductoross/conductor/ai/agentspan/runtime/service/ListApiToolsTask.java:259 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix the spec server to return a Location header on redirects, or point the tool directly at the final URL."],"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"}