floci-io/floci · error · AwsException

InternalServerErrorException

InternalServerErrorException

Error message

Failed to provision broker " + name

What it means

CreateBroker succeeded at the validation layer but RabbitMqManager.startContainer threw while launching the RabbitMQ Docker container (image pull failure, Docker daemon unreachable, port conflicts). Floci marks the broker CREATION_FAILED, logs the cause server-side, and returns a 500 InternalServerErrorException without leaking internals.

Source

Thrown at src/main/java/io/github/hectorvent/floci/services/amazonmq/AmazonMqService.java:137

            broker.setTags(new HashMap<>(params.tags()));
        }

        if (config.services().amazonmq().mock()) {
            // No backing container: come up immediately with synthetic endpoints.
            applyLocalEndpoints(broker);
            broker.setBrokerState(BrokerState.RUNNING);
        } else {
            try {
                // Start the container; the broker stays CREATION_IN_PROGRESS until
                // the readiness poller observes the management API answering.
                rabbitMqManager.startContainer(broker);
            } catch (RuntimeException e) {
                broker.setBrokerState(BrokerState.CREATION_FAILED);
                storage.put(brokerId, broker);
                // Keep the cause in the logs; don't leak internal details (or a null
                // message) into the AWS error envelope returned to the client.
                LOG.errorv(e, "Failed to provision broker {0} ({1})", name, brokerId);
                throw new AwsException("InternalServerErrorException",
                        "Failed to provision broker " + name, 500);
            }
        }

        storage.put(brokerId, broker);
        LOG.infov("Created Amazon MQ broker {0} ({1})", name, brokerId);
        return broker;
    }

    public Broker describeBroker(String brokerId) {
        return storage.get(brokerId)
                .orElseThrow(() -> new AwsException("NotFoundException",
                        "Broker not found: " + brokerId, 404));
    }

    public List<Broker> listBrokers() {
        return storage.scan(k -> true);
    }

View on GitHub (pinned to 62ff490619)

Solutions

  1. Verify Docker is reachable from the emulator process: docker ps && docker pull rabbitmq:management
  2. Free the default ports (5672 AMQP, 15672 management) or reconfigure the port range under floci.* Docker/port settings
  3. Check emulator logs for the LOG.errorv entry 'Failed to provision broker' — the underlying cause (pull error, bind error) is recorded there
  4. Ensure the user running Floci is in the docker group or the socket is mounted with adequate permissions
Defensive patterns

Strategy: retry

Validate before calling

// preflight: Docker reachable and image present
Process p = Runtime.getRuntime().exec(new String[]{"docker", "inspect", "rabbitmq:management"});
if (p.waitFor() != 0) throw new IllegalStateException("RabbitMQ image missing; run docker pull rabbitmq:management");

Try / catch

try {
    broker = mqClient.createBroker(req);
} catch (InternalServerErrorException e) {
    // container start failures are often transient (pull, port bind); retry after fixing env
    log.warn("Provisioning failed for {}; check Docker and ports", name, e);
    throw e;
}

Prevention

When it happens

Trigger: Docker daemon not running; rabbitmq image not present locally and registry unreachable; host ports 5672/15672 already bound; Docker socket permission issues for the emulator process.

Common situations: CI environments without Docker-in-Docker set up; local machines where port 5672 is taken by a natively installed RabbitMQ; air-gapped environments that cannot pull the rabbitmq image on first use; Docker group permission errors for the user running Quarkus.

Related errors


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