{"record":{"id":"548824b57f27b115","repo":"floci-io/floci","slug":"internalservererrorexception","errorCode":"InternalServerErrorException","errorMessage":"Failed to provision broker \" + name","messagePattern":"Failed to provision broker \" \\+ name","errorType":"http","errorClass":"AwsException","httpStatus":500,"severity":"error","filePath":"src/main/java/io/github/hectorvent/floci/services/amazonmq/AmazonMqService.java","lineNumber":137,"sourceCode":"            broker.setTags(new HashMap<>(params.tags()));\n        }\n\n        if (config.services().amazonmq().mock()) {\n            // No backing container: come up immediately with synthetic endpoints.\n            applyLocalEndpoints(broker);\n            broker.setBrokerState(BrokerState.RUNNING);\n        } else {\n            try {\n                // Start the container; the broker stays CREATION_IN_PROGRESS until\n                // the readiness poller observes the management API answering.\n                rabbitMqManager.startContainer(broker);\n            } catch (RuntimeException e) {\n                broker.setBrokerState(BrokerState.CREATION_FAILED);\n                storage.put(brokerId, broker);\n                // Keep the cause in the logs; don't leak internal details (or a null\n                // message) into the AWS error envelope returned to the client.\n                LOG.errorv(e, \"Failed to provision broker {0} ({1})\", name, brokerId);\n                throw new AwsException(\"InternalServerErrorException\",\n                        \"Failed to provision broker \" + name, 500);\n            }\n        }\n\n        storage.put(brokerId, broker);\n        LOG.infov(\"Created Amazon MQ broker {0} ({1})\", name, brokerId);\n        return broker;\n    }\n\n    public Broker describeBroker(String brokerId) {\n        return storage.get(brokerId)\n                .orElseThrow(() -> new AwsException(\"NotFoundException\",\n                        \"Broker not found: \" + brokerId, 404));\n    }\n\n    public List<Broker> listBrokers() {\n        return storage.scan(k -> true);\n    }","sourceCodeStart":119,"sourceCodeEnd":155,"githubUrl":"https://github.com/floci-io/floci/blob/62ff490619e7bd3554597c28c704081b4c15add5/src/main/java/io/github/hectorvent/floci/services/amazonmq/AmazonMqService.java#L119-L155","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Verify Docker is reachable from the emulator process: docker ps && docker pull rabbitmq:management","Free the default ports (5672 AMQP, 15672 management) or reconfigure the port range under floci.* Docker/port settings","Check emulator logs for the LOG.errorv entry 'Failed to provision broker' — the underlying cause (pull error, bind error) is recorded there","Ensure the user running Floci is in the docker group or the socket is mounted with adequate permissions"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// preflight: Docker reachable and image present\nProcess p = Runtime.getRuntime().exec(new String[]{\"docker\", \"inspect\", \"rabbitmq:management\"});\nif (p.waitFor() != 0) throw new IllegalStateException(\"RabbitMQ image missing; run docker pull rabbitmq:management\");","typeGuard":null,"tryCatchPattern":"try {\n    broker = mqClient.createBroker(req);\n} catch (InternalServerErrorException e) {\n    // container start failures are often transient (pull, port bind); retry after fixing env\n    log.warn(\"Provisioning failed for {}; check Docker and ports\", name, e);\n    throw e;\n}","preventionTips":["Preflight docker ps and docker pull rabbitmq:management before test suites","Reserve ports 5672/15672 exclusively for the emulator; stop native RabbitMQ services","Treat a 500 from CreateBroker as infrastructure, not payload: inspect emulator logs before changing the request"],"tags":["amazonmq","docker","container","provisioning","infrastructure"],"backgroundTag":null,"analyzedSha":"62ff490619e7bd3554597c28c704081b4c15add5","analyzedAt":"2026-08-14T14:25:23.764Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}