floci-io/floci · error · AwsException

ValidationException

ValidationException

Error message

modelId is required.

What it means

Thrown by Floci's Bedrock Runtime REST controller when the {modelId} path parameter on POST /{modelId}/converse is missing or blank. Because the JAX-RS path template requires {modelId:.+}, this is mostly defensive — it fires when the routed modelId resolves to an empty string.

Source

Thrown at src/main/java/io/github/hectorvent/floci/services/bedrockruntime/BedrockRuntimeController.java:49

public class BedrockRuntimeController {

    private static final Logger LOG = Logger.getLogger(BedrockRuntimeController.class);

    private final BedrockRuntimeService service;
    private final ObjectMapper objectMapper;

    @Inject
    public BedrockRuntimeController(BedrockRuntimeService service, ObjectMapper objectMapper) {
        this.service = service;
        this.objectMapper = objectMapper;
    }

    @POST
    @Blocking
    @Path("/{modelId:.+}/converse")
    public Response converse(@PathParam("modelId") String modelId, String body) {
        if (modelId == null || modelId.isBlank()) {
            throw new AwsException("ValidationException", "modelId is required.", 400);
        }
        JsonNode request;
        try {
            request = body == null || body.isBlank()
                    ? objectMapper.createObjectNode()
                    : objectMapper.readTree(body);
        } catch (Exception e) {
            throw new AwsException("ValidationException",
                    "Malformed request body: " + e.getMessage(), 400);
        }

        JsonNode messages = request.path("messages");
        if (!messages.isArray() || messages.isEmpty()) {
            throw new AwsException("ValidationException",
                    "messages is required and must be a non-empty array.", 400);
        }

        ObjectNode response = service.buildConverseResponse(modelId, (ObjectNode) request);

View on GitHub (pinned to 62ff490619)

Solutions

  1. Verify the request URL looks like POST https://host/model/<modelId>/converse with a non-empty modelId
  2. Check the AWS SDK endpoint override and any reverse-proxy rewrite rules in front of Floci
  3. Confirm the Bedrock client is constructed with a concrete model id (e.g. anthropic.claude-3-haiku-...) so the SDK builds the right path

Example fix

// before
bedrockRuntimeClient.converse(req -> req.modelId(""));
// after
bedrockRuntimeClient.converse(req -> req.modelId("anthropic.claude-3-haiku-20240307-v1:0"));
Defensive patterns

Strategy: validation

Validate before calling

if (modelId == null || modelId.isBlank()) throw new IllegalArgumentException("modelId required");

Prevention

When it happens

Trigger: POSTing to /model/invoke or /converse with a URL that yields an empty modelId segment (e.g. trailing-slash or rewrite quirks), or calling Converse with a model id composed only of characters stripped by routing.

Common situations: Base-URL misconfiguration where the SDK endpoint path is rewritten; using a proxy or ALB rule that drops the model id segment; SDK configured with an endpoint override lacking the model in the path.

Related errors


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