floci-io/floci · warning · AwsException

UnsupportedOperationException

UnsupportedOperationException

Error message

InvokeModelWithResponseStream is not supported by Floci yet. Use InvokeModel or Converse instead.

What it means

Floci does not implement the streaming variant of Bedrock InvokeModel. The endpoint is declared (so clients get a defined 501 rather than a 404) but immediately rejects the call, directing you to the non-streaming InvokeModel or Converse operations.

Source

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

    @Blocking
    @Path("/{modelId:.+}/invoke")
    @Consumes(MediaType.WILDCARD)
    public Response invokeModel(@PathParam("modelId") String modelId, byte[] body) {
        if (modelId == null || modelId.isBlank()) {
            throw new AwsException("ValidationException", "modelId is required.", 400);
        }
        // Bedrock InvokeModel bodies are model-specific opaque blobs; do not parse.
        byte[] response = service.buildInvokeModelResponse(modelId, body);
        LOG.debugv("Bedrock InvokeModel: modelId={0}, bodyBytes={1}",
                modelId, body == null ? 0 : body.length);
        return Response.ok(response, MediaType.APPLICATION_JSON).build();
    }

    @POST
    @Path("/{modelId:.+}/invoke-with-response-stream")
    @Consumes(MediaType.WILDCARD)
    public Response invokeModelWithResponseStream(@PathParam("modelId") String modelId) {
        throw new AwsException("UnsupportedOperationException",
                "InvokeModelWithResponseStream is not supported by Floci yet. "
                        + "Use InvokeModel or Converse instead.", 501);
    }

    @POST
    @Path("/{modelId:.+}/converse-stream")
    @Consumes(MediaType.WILDCARD)
    public Response converseStream(@PathParam("modelId") String modelId) {
        throw new AwsException("UnsupportedOperationException",
                "ConverseStream is not supported by Floci yet. "
                        + "Use Converse instead.", 501);
    }
}

View on GitHub (pinned to 62ff490619)

Solutions

  1. Switch the call to invokeModel (non-streaming) or converse
  2. If streaming is mandatory, route Bedrock traffic to real AWS or another provider and use Floci only for other services
  3. Watch the Floci roadmap/issues for streaming support before upgrading

Example fix

// before
ResponseHandler<InvokeModelWithResponseStreamResponse, ?> h = ...;
client.invokeModelWithResponseStream(req -> req.modelId(m), h);
// after
InvokeModelResponse r = client.invokeModel(req -> req.modelId(m).body(b -> b.text(prompt)));
Defensive patterns

Strategy: fallback

Try / catch

try {
    client.invokeModelWithResponseStream(req, handler);
} catch (SdkException e) { // Floci returns 501
    InvokeModelResponse r = client.invokeModel(req2); // non-streaming fallback
}

Prevention

When it happens

Trigger: Calling the AWS SDK invokeModelWithResponseStream(...) or POST /model/{modelId}/invoke-with-response-stream against Floci.

Common situations: Reusing production code that streams tokens; SDK response-stream handlers are default in some wrappers. There is no configuration to enable it — it is a capability gap.

Understand the failure class

Background: UnsupportedOperationException in Java libraries: what this error means, why libraries throw it on purpose, and how to fix it — this error's family across 31 libraries.

Related errors


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