testcontainers/testcontainers-java · warning
Your provided admin password is too short and will not work…
Error message
Your provided admin password is too short and will not work with Neo4j 5.3+.
What it means
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.
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)
Example fix
// before
neo4j.withAdminPassword("secret"); // 6 chars
// after
neo4j.withRandomPassword();
String pwd = neo4j.getAdminPassword(); Defensive patterns
Strategy: validation
Validate before calling
String pwd = "secret1"; // example
if (pwd != null && pwd.length() < 8) {
throw new IllegalArgumentException("Neo4j 5.3+ requires admin password >= 8 chars");
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- Version is not a semantic version. The function…
- Copying databases is only supported for Neo4j versions 3.5.x
- Authentication failed.
- HTTP response code was
- Response: did not match predicate
AI-assisted analysis of testcontainers/testcontainers-java@8e549514e3 (2026-09-12).
Data as JSON: /api/errors/c2c527f2d1cd84bf.
Report an issue: GitHub.
Appendix: source
Thrown at modules/neo4j/src/main/java/org/testcontainers/containers/Neo4jContainer.java:244
setDockerImageName(DEFAULT_IMAGE_NAME.withTag(ENTERPRISE_TAG).asCanonicalNameString());
LicenseAcceptance.assertLicenseAccepted(getDockerImageName());
addEnv("NEO4J_ACCEPT_LICENSE_AGREEMENT", "yes");
return self();
}
/**
* Sets the admin password for the default account (which is <pre>neo4j</pre>). A null value or an empty string
* disables authentication.
*
* @param adminPassword The admin password for the default database account.
* @return This container.
*/
public S withAdminPassword(final String adminPassword) {
if (adminPassword != null && adminPassword.length() < 8) {
logger().warn("Your provided admin password is too short and will not work with Neo4j 5.3+.");
}
this.adminPassword = adminPassword;
return self();
}
/**
* Disables authentication.
*
* @return This container.
*/
public S withoutAuthentication() {
return withAdminPassword(null);
}
/**
* Copies an existing {@code graph.db} folder into the container. This can either be a classpath resource or a
* host resource. Please have a look at the factory methods in {@link MountableFile}.
* <br>View on GitHub (pinned to 8e549514e3)