{"record":{"id":"c2c527f2d1cd84bf","repo":"testcontainers/testcontainers-java","slug":"your-provided-admin-password-is-too-short-and-will-not-work","errorCode":null,"errorMessage":"Your provided admin password is too short and will not work with Neo4j 5.3+.","messagePattern":"Your provided admin password is too short and will not work with Neo4j 5\\.3\\+\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"modules/neo4j/src/main/java/org/testcontainers/containers/Neo4jContainer.java","lineNumber":244,"sourceCode":"\n        setDockerImageName(DEFAULT_IMAGE_NAME.withTag(ENTERPRISE_TAG).asCanonicalNameString());\n        LicenseAcceptance.assertLicenseAccepted(getDockerImageName());\n\n        addEnv(\"NEO4J_ACCEPT_LICENSE_AGREEMENT\", \"yes\");\n\n        return self();\n    }\n\n    /**\n     * Sets the admin password for the default account (which is <pre>neo4j</pre>). A null value or an empty string\n     * disables authentication.\n     *\n     * @param adminPassword The admin password for the default database account.\n     * @return This container.\n     */\n    public S withAdminPassword(final String adminPassword) {\n        if (adminPassword != null && adminPassword.length() < 8) {\n            logger().warn(\"Your provided admin password is too short and will not work with Neo4j 5.3+.\");\n        }\n        this.adminPassword = adminPassword;\n        return self();\n    }\n\n    /**\n     * Disables authentication.\n     *\n     * @return This container.\n     */\n    public S withoutAuthentication() {\n        return withAdminPassword(null);\n    }\n\n    /**\n     * Copies an existing {@code graph.db} folder into the container. This can either be a classpath resource or a\n     * host resource. Please have a look at the factory methods in {@link MountableFile}.\n     * <br>","sourceCodeStart":226,"sourceCodeEnd":262,"githubUrl":"https://github.com/testcontainers/testcontainers-java/blob/8e549514e3f01c57d70546fbb8599d138f3903e5/modules/neo4j/src/main/java/org/testcontainers/containers/Neo4jContainer.java#L226-L262","documentation":"Neo4jContainer.withAdminPassword warns when the provided admin password is shorter than 8 characters, because Neo4j 5.3+ enforces a minimum password length of 8 and would reject the container's attempt to set it, failing startup or authentication. The value is still stored and applied, so with older Neo4j images a short password continues to work — the warning is version-specific.","triggerScenarios":"Calling withAdminPassword(\"short\") (length < 8) on a Neo4jContainer running a Neo4j 5.3+ image; also reachable indirectly through withoutAuthentication(null is fine, no warning) but any non-null <8-char string triggers it.","commonSituations":"Using trivial test passwords like 'secret' or 'admin' while the image was upgraded from Neo4j 4.x/5.0-5.2 to 5.3+; hard-coded credentials in test config.","solutions":["Provide a password of at least 8 characters, e.g. withAdminPassword(\"s3cretpassword\")","Call withRandomPassword() instead of a fixed short password and read the password via getAdminPassword()","Pin the image to a pre-5.3 Neo4j version if a legacy short password must be kept (not recommended)"],"exampleFix":"// before\nneo4j.withAdminPassword(\"secret\"); // 6 chars\n// after\nneo4j.withRandomPassword();\nString pwd = neo4j.getAdminPassword();","handlingStrategy":"validation","validationCode":"String pwd = \"secret1\"; // example\nif (pwd != null && pwd.length() < 8) {\n    throw new IllegalArgumentException(\"Neo4j 5.3+ requires admin password >= 8 chars\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Enforce a >= 8 character password policy for test credentials","Prefer withRandomPassword() + getAdminPassword() over hard-coded passwords","Keep password requirements in sync with the Neo4j image version you pin"],"tags":["neo4j","password-policy","authentication","testcontainers"],"backgroundTag":"invalid-argument-value","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"}