{"record":{"id":"b5fb964515c80501","repo":"testcontainers/testcontainers-java","slug":"unable-to-create-solr-core-stdout-result-getstdout-stderr-b5fb96","errorCode":null,"errorMessage":"Unable to create solr core:\nStdout: ${result.getStdout()}\nStderr:${result.getStderr()}","messagePattern":"Unable to create solr core:\nStdout: (.+?)\nStderr:(.+?)","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"modules/solr/src/main/java/org/testcontainers/solr/SolrContainer.java","lineNumber":132,"sourceCode":"    }\n\n    @Override\n    public Set<Integer> getLivenessCheckPortNumbers() {\n        return new HashSet<>(getSolrPort());\n    }\n\n    @Override\n    protected void waitUntilContainerStarted() {\n        getWaitStrategy().waitUntilReady(this);\n    }\n\n    @Override\n    @SneakyThrows\n    protected void containerIsStarted(InspectContainerResponse containerInfo) {\n        if (!configuration.isZookeeper()) {\n            ExecResult result = execInContainer(\"solr\", \"create\", \"-c\", configuration.getCollectionName());\n            if (result.getExitCode() != 0) {\n                throw new IllegalStateException(\n                    \"Unable to create solr core:\\nStdout: \" + result.getStdout() + \"\\nStderr:\" + result.getStderr()\n                );\n            }\n            return;\n        }\n\n        if (StringUtils.isNotEmpty(configuration.getConfigurationName())) {\n            SolrClientUtils.uploadConfiguration(\n                getHost(),\n                getSolrPort(),\n                configuration.getConfigurationName(),\n                configuration.getSolrConfiguration(),\n                configuration.getSolrSchema()\n            );\n        }\n\n        SolrClientUtils.createCollection(\n            getHost(),","sourceCodeStart":114,"sourceCodeEnd":150,"githubUrl":"https://github.com/testcontainers/testcontainers-java/blob/8e549514e3f01c57d70546fbb8599d138f3903e5/modules/solr/src/main/java/org/testcontainers/solr/SolrContainer.java#L114-L150","documentation":"In the newer org.testcontainers.solr.SolrContainer, standalone (non-ZooKeeper) mode creates the core via `solr create -c <collection>` after startup. A non-zero exit code from that exec produces this IllegalStateException carrying the command's stdout and stderr.","triggerScenarios":"containerIsStarted runs the create-core exec and it fails — invalid collection name, existing core, broken uploaded configset, or Solr not ready to accept create requests.","commonSituations":"Custom configuration missing required files, duplicate withCollection names across tests reusing a container, or corrupted config mounted into the container.","solutions":["Inspect Stdout/Stderr in the exception message for the underlying solr create failure.","Ensure the configuration and schema files form a valid configset.","Check the collection name for illegal characters.","Enable ZooKeeper mode for SolrCloud-style collection handling."],"exampleFix":"// before\nExecResult r = execInContainer(\"solr\", \"create\", \"-c\", \"\");\n// after\nExecResult r = execInContainer(\"solr\", \"create\", \"-c\", \"valid_core_name\");","handlingStrategy":"try-catch","validationCode":"if (name == null || !name.matches(\"[A-Za-z0-9_]+\")) throw new IllegalArgumentException(\"invalid Solr core name: \" + name);","typeGuard":null,"tryCatchPattern":"try { container.start(); } catch (IllegalStateException e) { if (e.getMessage().contains(\"Unable to create solr core\")) { log.error(\"solr create failed: {}\", e.getMessage()); } throw e; }","preventionTips":["Validate the uploaded configset contains solrconfig.xml and schema.xml.","Avoid creating two cores with the same name.","Check container logs when core creation fails."],"tags":["solr","testcontainers","core-creation"],"backgroundTag":"command-failed","analyzedSha":"8e549514e3f01c57d70546fbb8599d138f3903e5","analyzedAt":"2026-09-12T14:56:41.227Z","contentChangedAt":"2026-09-12T14:56:41.227Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}