conductor-oss/conductor · error · IllegalArgumentException

API spec exceeded the redirect limit

Error message

API spec exceeded the redirect limit

What it means

Error "API spec exceeded the redirect limit" thrown in conductor-oss/conductor.

Source

Thrown at agentspan/src/main/java/org/conductoross/conductor/ai/agentspan/runtime/service/ListApiToolsTask.java:269

            addHeaders(request, headers);
            HttpResponse<byte[]> response =
                    httpClient.send(request.build(), HttpResponse.BodyHandlers.ofByteArray());
            if (response.statusCode() < 300 || response.statusCode() >= 400) {
                return response;
            }
            String location = response.headers().firstValue("Location").orElse(null);
            if (location == null) {
                throw new IllegalArgumentException(
                        "API spec redirect is missing a Location header");
            }
            String target = URI.create(currentUrl).resolve(location).toString();
            if (hasSensitiveHeaders(headers) && !isSameOrigin(currentUrl, target)) {
                throw new IllegalArgumentException(
                        "Refusing to forward credentials across an API spec redirect");
            }
            currentUrl = target;
        }
        throw new IllegalArgumentException("API spec exceeded the redirect limit");
    }

    private void addHeaders(HttpRequest.Builder builder, Map<String, String> headers) {
        if (headers == null) {
            return;
        }
        headers.forEach(
                (name, value) -> {
                    if (name == null
                            || value == null
                            || name.indexOf('\r') >= 0
                            || name.indexOf('\n') >= 0
                            || value.indexOf('\r') >= 0
                            || value.indexOf('\n') >= 0) {
                        throw new IllegalArgumentException(
                                "API spec headers must not contain CR or LF characters");
                    }
                    builder.header(name, value);

View on GitHub (pinned to cf7c3e4a8a)

Solutions

  1. Point the API spec URL directly at the final location to avoid redirect chains.
  2. Check the hosting server for a redirect loop.

When it happens

Trigger: Thrown at agentspan/src/main/java/org/conductoross/conductor/ai/agentspan/runtime/service/ListApiToolsTask.java:269 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of conductor-oss/conductor@cf7c3e4a8a (2026-08-14). Data as JSON: /api/errors/2dab3b0ccb7c7b6c. Report an issue: GitHub.