{"record":{"id":"3cd943f197aa4f20","repo":"testcontainers/testcontainers-java","slug":"username-cannot-be-one-of-system-sys-oraclecontainer","errorCode":null,"errorMessage":"Username cannot be one of [system, sys]","messagePattern":"Username cannot be one of \\[system, sys\\]","errorType":"validation","errorClass":"java.lang.IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/oracle-xe/src/main/java/org/testcontainers/containers/OracleContainer.java","lineNumber":154,"sourceCode":"        return password;\n    }\n\n    @Override\n    public String getDatabaseName() {\n        return databaseName;\n    }\n\n    protected boolean isUsingSid() {\n        return usingSid;\n    }\n\n    @Override\n    public OracleContainer withUsername(String username) {\n        if (StringUtils.isEmpty(username)) {\n            throw new IllegalArgumentException(\"Username cannot be null or empty\");\n        }\n        if (ORACLE_SYSTEM_USERS.contains(username.toLowerCase())) {\n            throw new IllegalArgumentException(\"Username cannot be one of \" + ORACLE_SYSTEM_USERS);\n        }\n        this.username = username;\n        return self();\n    }\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\");","sourceCodeStart":136,"sourceCodeEnd":172,"githubUrl":"https://github.com/testcontainers/testcontainers-java/blob/8e549514e3f01c57d70546fbb8599d138f3903e5/modules/oracle-xe/src/main/java/org/testcontainers/containers/OracleContainer.java#L136-L172","documentation":"OracleContainer.withUsername() rejects usernames that match Oracle system users (system, sys, case-insensitively). Testcontainers creates the configured user itself and connecting/creating as a system user is unsupported and would conflict with container initialization, so it throws IllegalArgumentException.","triggerScenarios":"Calling container.withUsername(\"system\"), withUsername(\"SYS\") or any case variant of a user in ORACLE_SYSTEM_USERS.","commonSituations":"Copying connection settings from an existing Oracle DB where apps historically logged in as 'system'; defaulting the username from an env var that says 'system'.","solutions":["Use a dedicated application user name, e.g. withUsername(\"app_user\")","Remove the override entirely and let the container use its default non-system user","If you need system-level access, exec into the running container with docker exec and connect as sys there instead"],"exampleFix":"// before\ncontainer.withUsername(\"system\");\n// after\ncontainer.withUsername(\"app_user\");","handlingStrategy":"validation","validationCode":"Set.of(\"system\",\"sys\").contains(user.toLowerCase()) -> reject before calling withUsername","typeGuard":"boolean isOracleSystemUser(String u) { return u != null && (u.equalsIgnoreCase(\"system\") || u.equalsIgnoreCase(\"sys\")); }","tryCatchPattern":"try { container.withUsername(user); } catch (IllegalArgumentException e) { log.warn(\"system user rejected, using default\"); }","preventionTips":["Never configure app containers to use Oracle system accounts","Centralize test DB user names in constants","Add config validation that rejects reserved usernames early"],"tags":["oracle","testcontainers","validation","reserved-words"],"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"}