{"record":{"id":"9cbf0cc4937794df","repo":"floci-io/floci","slug":"modelerrorexception","errorCode":"ModelErrorException","errorMessage":"Failed to reach proxy backend: {}","messagePattern":"Failed to reach proxy backend: (.+?)","errorType":"error_code","errorClass":"AwsException","httpStatus":424,"severity":"error","filePath":"src/main/java/io/github/hectorvent/floci/services/bedrockruntime/backend/ProxyBackend.java","lineNumber":94,"sourceCode":"\n        String requestBody;\n        try {\n            requestBody = objectMapper.writeValueAsString(openAiRequest);\n        } catch (Exception e) {\n            throw new AwsException(\"InternalServerException\", \"Failed to serialize proxy request: \" + e.getMessage(), 500);\n        }\n        builder.POST(HttpRequest.BodyPublishers.ofString(requestBody));\n\n        long start = System.nanoTime();\n        HttpResponse<String> response;\n        try {\n            response = httpClient.send(builder.build(), HttpResponse.BodyHandlers.ofString());\n        } catch (HttpTimeoutException e) {\n            LOG.warnv(\"Bedrock proxy backend timed out: modelId={0}, url={1}, error={2}\", modelId, uri, e.getMessage());\n            throw new AwsException(\"ModelTimeoutException\", \"Proxy backend timed out: \" + e.getMessage(), 408);\n        } catch (Exception e) {\n            LOG.warnv(\"Bedrock proxy backend call failed: modelId={0}, url={1}, error={2}\", modelId, uri, e.getMessage());\n            throw new AwsException(\"ModelErrorException\", \"Failed to reach proxy backend: \" + e.getMessage(), 424);\n        }\n        long latencyMs = (System.nanoTime() - start) / 1_000_000;\n\n        if (response.statusCode() >= 300) {\n            LOG.warnv(\"Bedrock proxy backend returned HTTP {0}: {1}\", response.statusCode(), response.body());\n            throw new AwsException(\"ModelErrorException\",\n                    \"Proxy backend returned HTTP \" + response.statusCode() + \": \" + truncate(response.body(), 512),\n                    424);\n        }\n\n        JsonNode openAiResponse;\n        try {\n            openAiResponse = objectMapper.readTree(response.body());\n        } catch (Exception e) {\n            throw new AwsException(\"ModelErrorException\", \"Proxy backend returned malformed JSON: \" + e.getMessage(), 424);\n        }\n\n        return BedrockOpenAiTranslator.toBedrockResponse(objectMapper, openAiResponse, latencyMs);","sourceCodeStart":76,"sourceCodeEnd":112,"githubUrl":"https://github.com/floci-io/floci/blob/62ff490619e7bd3554597c28c704081b4c15add5/src/main/java/io/github/hectorvent/floci/services/bedrockruntime/backend/ProxyBackend.java#L76-L112","documentation":"The HTTP call to the Bedrock proxy backend failed with a non-timeout exception — connection refused, unknown host, DNS failure, or SSL error. Mapped to ModelErrorException with HTTP 424 (Failed Dependency), since Floci is healthy but its upstream is not.","triggerScenarios":"The proxy URL points at a service that is down (connection refused), a wrong port, an unresolvable hostname, or a TLS mismatch (https against a plain-HTTP endpoint).","commonSituations":"Ollama/LLaMA.sh/local gateway not started or listening on a different port; Docker networking (localhost inside a container is not the host); typo in the hostname.","solutions":["Verify the upstream is reachable: curl <proxy-url>/chat/completions from the Floci host/container","In Docker, use host.docker.internal (or the service name) instead of localhost","Match the scheme to the listener: http:// for local plain-HTTP servers"],"exampleFix":"# before\nFLOCI_SERVICES_BEDROCK_RUNTIME_PROXY_URL=http://localhost:11434   # inside a container\n# after\nFLOCI_SERVICES_BEDROCK_RUNTIME_PROXY_URL=http://host.docker.internal:11434","handlingStrategy":"try-catch","validationCode":"// preflight from where Floci runs:\n// curl -sf \"$PROXY_URL/chat/completions\" -d '{}' or a TCP check on host:port","typeGuard":null,"tryCatchPattern":"try {\n    converse(req);\n} catch (ModelErrorException e) { // 424\n    runDiagnostics(proxyUrl); // reachability + DNS check, then surface actionable error\n}","preventionTips":["Containerize Floci and the LLM backend together or use host.docker.internal","Add a health check for the proxy URL to your compose file"],"tags":["bedrock","proxy","network","docker","floci"],"backgroundTag":null,"analyzedSha":"62ff490619e7bd3554597c28c704081b4c15add5","analyzedAt":"2026-08-14T14:25:23.764Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}