{"record":{"id":"c7b5ebae24fda6f6","repo":"testcontainers/testcontainers-java","slug":"copying-databases-is-only-supported-for-neo4j-versions-3-5-x","errorCode":null,"errorMessage":"Copying databases is only supported for Neo4j versions 3.5.x","messagePattern":"Copying databases is only supported for Neo4j versions 3\\.5\\.x","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"modules/neo4j/src/main/java/org/testcontainers/containers/Neo4jContainer.java","lineNumber":360,"sourceCode":"    }\n\n    private boolean isNeo4jDatabaseVersionSupportingDbCopy() {\n        String usedImageVersion = DockerImageName.parse(getDockerImageName()).getVersionPart();\n        ComparableVersion usedComparableVersion = new ComparableVersion(usedImageVersion);\n\n        boolean versionSupportingDbCopy =\n            usedComparableVersion.isLessThan(\"4.0\") && usedComparableVersion.isGreaterThanOrEqualTo(\"2\");\n\n        if (versionSupportingDbCopy) {\n            return true;\n        }\n        if (!usedComparableVersion.isSemanticVersion()) {\n            logger()\n                .warn(\n                    \"Version {} is not a semantic version. The function \\\"withDatabase\\\" will fail.\",\n                    usedImageVersion\n                );\n            logger().warn(\"Copying databases is only supported for Neo4j versions 3.5.x\");\n        }\n\n        return false;\n    }\n\n    public S withRandomPassword() {\n        return withAdminPassword(UUID.randomUUID().toString());\n    }\n}\n","sourceCodeStart":342,"sourceCodeEnd":370,"githubUrl":"https://github.com/testcontainers/testcontainers-java/blob/8e549514e3f01c57d70546fbb8599d138f3903e5/modules/neo4j/src/main/java/org/testcontainers/containers/Neo4jContainer.java#L342-L370","documentation":"Follow-up warning from isNeo4jDatabaseVersionSupportingDbCopy: after failing to confirm a semantic version, Testcontainers logs that copying databases is only supported for Neo4j versions 3.5.x and returns false. Subsequently, withDatabase() will not perform the database-copy operation, so callers relying on it get a container without the extra named database (or a downstream failure) rather than the expected setup.","triggerScenarios":"withDatabase(\"name\") invoked with a non-semantic or non-3.5.x Neo4j image version; the method short-circuits: versionSupportingDbCopy false -> warn -> return false.","commonSituations":"Migrating tests from Neo4j 3.5 to 4.x/5.x where withDatabase() was used; custom or 'latest' tagged images where the version cannot be evaluated at all.","solutions":["Use a Neo4j 3.5.x image tag if database copy is required","Drop withDatabase() for modern Neo4j and provision databases with an init script executing Cypher (CREATE DATABASE / :use)","Pin a semantic version tag so version detection works"],"exampleFix":"// before\nnew Neo4jContainer(\"neo4j:5.11\").withDatabase(\"extra\"); // unsupported copy\n// after (Neo4j 5: create db via init script instead)\nnew Neo4jContainer(\"neo4j:5.11\")\n    .withInitScript(\"createDb.cypher\"); // CREATE DATABASE extra IF NOT EXISTS","handlingStrategy":"fallback","validationCode":"String tag = image.getVersionPart();\nif (!tag.startsWith(\"3.5\")) {\n    // skip withDatabase(); create the database via an init script instead\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Check the Neo4j major version before calling withDatabase()","Use init scripts (Cypher CREATE DATABASE) for Neo4j 4+/5+","Pin images to exact semver tags so version-gated features behave predictably"],"tags":["neo4j","versioning","database-copy","testcontainers"],"backgroundTag":"unsupported-operation","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"}