{"record":{"id":"ac9a640ce3df8a81","repo":"testcontainers/testcontainers-java","slug":"database-name-cannot-be-set-to-freepdb1","errorCode":null,"errorMessage":"Database name cannot be set to freepdb1","messagePattern":"Database name cannot be set to freepdb1","errorType":"validation","errorClass":"java.lang.IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/oracle-free/src/main/java/org/testcontainers/oracle/OracleContainer.java","lineNumber":155,"sourceCode":"    }\n\n    @Override\n    public OracleContainer withPassword(String password) {\n        if (StringUtils.isEmpty(password)) {\n            throw new IllegalArgumentException(\"Password cannot be null or empty\");\n        }\n        this.password = password;\n        return self();\n    }\n\n    @Override\n    public OracleContainer withDatabaseName(String databaseName) {\n        if (StringUtils.isEmpty(databaseName)) {\n            throw new IllegalArgumentException(\"Database name cannot be null or empty\");\n        }\n\n        if (DEFAULT_DATABASE_NAME.equals(databaseName.toLowerCase())) {\n            throw new IllegalArgumentException(\"Database name cannot be set to \" + DEFAULT_DATABASE_NAME);\n        }\n\n        this.databaseName = databaseName;\n        return self();\n    }\n\n    public OracleContainer usingSid() {\n        this.usingSid = true;\n        return self();\n    }\n\n    @Override\n    public OracleContainer withUrlParam(String paramName, String paramValue) {\n        throw new UnsupportedOperationException(\"The Oracle Database driver does not support this\");\n    }\n\n    @SuppressWarnings(\"SameReturnValue\")\n    public String getSid() {","sourceCodeStart":137,"sourceCodeEnd":173,"githubUrl":"https://github.com/testcontainers/testcontainers-java/blob/8e549514e3f01c57d70546fbb8599d138f3903e5/modules/oracle-free/src/main/java/org/testcontainers/oracle/OracleContainer.java#L137-L173","documentation":"OracleContainer.withDatabaseName() rejects the built-in default PDB name (freepdb1, compared case-insensitively) because overriding it with the same value the container already uses by default would be misleading and can conflict with the container's service setup. An IllegalArgumentException naming the reserved value is thrown.","triggerScenarios":"Calling withDatabaseName(\"freepdb1\") or any case variant equal to DEFAULT_DATABASE_NAME.","commonSituations":"Copy-pasting the default PDB name seen in connection logs back into withDatabaseName; templated configs where the default leaks into the override field.","solutions":["Choose a distinct custom name, e.g. withDatabaseName(\"appdb\").","Remove the withDatabaseName call entirely if the default freepdb1 is what you want.","Fix templating so empty/default placeholders don't produce 'freepdb1' as an override."],"exampleFix":"// before\ncontainer.withDatabaseName(\"freepdb1\");\n// after\ncontainer.withDatabaseName(\"appdb\");","handlingStrategy":"validation","validationCode":"if (\"freepdb1\".equalsIgnoreCase(databaseName)) {\n    databaseName = \"appdb\"; // don't override with the built-in default\n}","typeGuard":null,"tryCatchPattern":"try {\n    container.withDatabaseName(databaseName);\n} catch (IllegalArgumentException e) {\n    // just don't override; container defaults to freepdb1\n}","preventionTips":["Don't pass the default PDB name as an override; skip the call instead.","Add a guard in config code for reserved/default names.","Pick a project-specific database name in tests."],"tags":["oracle","validation","database-name"],"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-16T09:17:16.951Z"}