floci-io/floci · error · AwsException
ValidationException
ValidationException
Error message
floci.services.bedrock-runtime.proxy.url is not a valid URL: {} What it means
The Bedrock proxy backend failed to build the upstream URL from floci.services.bedrock-runtime.proxy.url (plus /chat/completions). URI.create/HttpRequest.newBuilder threw IllegalArgumentException, meaning the configured base URL is syntactically invalid for a URI.
Source
Thrown at src/main/java/io/github/hectorvent/floci/services/bedrockruntime/backend/ProxyBackend.java:70
EmulatorConfig.BedrockProxyConfig proxyConfig = config.services().bedrockRuntime().proxy();
String resolvedModel = resolveModel(modelId, proxyConfig);
String baseUrl = proxyConfig.url()
.filter(url -> !url.isBlank())
.orElseThrow(() -> new AwsException("ValidationException",
"floci.services.bedrock-runtime.proxy.url is required when backend=proxy.", 400));
ObjectNode openAiRequest = BedrockOpenAiTranslator.toOpenAiRequest(objectMapper, bedrockRequest, resolvedModel);
URI uri;
HttpRequest.Builder builder;
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());View on GitHub (pinned to 62ff490619)
Solutions
- Set the property to a full URL with scheme and host, e.g. http://localhost:8080 or https://api.example.com
- Trim whitespace/newlines from the environment variable value
- Validate with java.net.URI.create(value) or curl before starting Floci
Example fix
# before FLOCI_SERVICES_BEDROCK_RUNTIME_PROXY_URL=localhost:11434 # after FLOCI_SERVICES_BEDROCK_RUNTIME_PROXY_URL=http://localhost:11434
Defensive patterns
Strategy: validation
Validate before calling
try {
java.net.URI.create(proxyUrl.trim());
} catch (IllegalArgumentException e) {
throw new IllegalStateException("Invalid FLOCI proxy url: " + proxyUrl, e);
} Prevention
- Validate the URL in CI config checks before booting the emulator
- Always include the scheme; avoid trailing spaces in env files
When it happens
Trigger: Setting FLOCI_SERVICES_BEDROCK_RUNTIME_PROXY_URL to a value with spaces, a missing scheme (e.g. 'localhost:8080'), or illegal URI characters. Note: only the builder calls are inside the try — the actual network call happens later, so this is purely URL construction.
Common situations: Env var quoting mistakes injecting whitespace; forgetting the http:// scheme; using a Windows-style path or a URL with unencoded spaces.
Related errors
- ValidationException
- UnsupportedOperationException
- InternalServerException
- ModelTimeoutException
- ModelErrorException
AI-assisted analysis of floci-io/floci@62ff490619 (2026-08-14).
Data as JSON: /api/errors/5a3b6b29a716c5c3.
Report an issue: GitHub.