floci-io/floci · error · AwsException

InternalServerException

InternalServerException

Error message

Failed to serialize proxy request: {}

What it means

Jackson failed while serializing the translated OpenAI request object before sending it to the Bedrock proxy backend. This is an internal 500 (InternalServerException) — the request never left Floci.

Source

Thrown at src/main/java/io/github/hectorvent/floci/services/bedrockruntime/backend/ProxyBackend.java:81

        try {
            uri = URI.create(stripTrailingSlash(baseUrl) + "/chat/completions");
            builder = HttpRequest.newBuilder()
                    .uri(uri)
                    .timeout(Duration.ofSeconds(proxyConfig.requestTimeoutSeconds()))
                    .header("Content-Type", "application/json");
        } catch (IllegalArgumentException e) {
            throw new AwsException("ValidationException",
                    "floci.services.bedrock-runtime.proxy.url is not a valid URL: " + e.getMessage(), 400);
        }
        proxyConfig.apiKey()
                .filter(key -> !key.isBlank())
                .ifPresent(key -> builder.header("Authorization", "Bearer " + key));

        String requestBody;
        try {
            requestBody = objectMapper.writeValueAsString(openAiRequest);
        } catch (Exception e) {
            throw new AwsException("InternalServerException", "Failed to serialize proxy request: " + e.getMessage(), 500);
        }
        builder.POST(HttpRequest.BodyPublishers.ofString(requestBody));

        long start = System.nanoTime();
        HttpResponse<String> response;
        try {
            response = httpClient.send(builder.build(), HttpResponse.BodyHandlers.ofString());
        } catch (HttpTimeoutException e) {
            LOG.warnv("Bedrock proxy backend timed out: modelId={0}, url={1}, error={2}", modelId, uri, e.getMessage());
            throw new AwsException("ModelTimeoutException", "Proxy backend timed out: " + e.getMessage(), 408);
        } catch (Exception e) {
            LOG.warnv("Bedrock proxy backend call failed: modelId={0}, url={1}, error={2}", modelId, uri, e.getMessage());
            throw new AwsException("ModelErrorException", "Failed to reach proxy backend: " + e.getMessage(), 424);
        }
        long latencyMs = (System.nanoTime() - start) / 1_000_000;

        if (response.statusCode() >= 300) {
            LOG.warnv("Bedrock proxy backend returned HTTP {0}: {1}", response.statusCode(), response.body());

View on GitHub (pinned to 62ff490619)

Solutions

  1. Simplify the request (plain text content blocks) and retry to isolate the offending member
  2. Inspect the appended exception message for the exact serialization failure
  3. Report to Floci with the minimal request JSON that reproduces it — an InternalServerException here is a bug, not a usage error
Defensive patterns

Strategy: try-catch

Try / catch

try {
    converse(req);
} catch (InternalServerException e) {
    // retry once with plain text content; if it recurs, report upstream to Floci
    log.error("Floci proxy serialization failed: {}", e.getMessage());
}

Prevention

When it happens

Trigger: A converse request whose structure, after Bedrock-to-OpenAI translation, produces a node Jackson cannot serialize (effectively a translator bug or an unexpected JsonNode shape).

Common situations: Rare; typically encountered with unusual message content blocks (e.g. document/toolUse-only content) that the BedrockOpenAiTranslator maps into a non-serializable structure. Check the appended Jackson message.

Related errors


AI-assisted analysis of floci-io/floci@62ff490619 (2026-08-14). Data as JSON: /api/errors/797d4a5eaf551dac. Report an issue: GitHub.