{"record":{"id":"cc5661db94cf874a","repo":"testcontainers/testcontainers-java","slug":"username-cannot-be-one-of-system-sys","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-free/src/main/java/org/testcontainers/oracle/OracleContainer.java","lineNumber":133,"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":115,"sourceCodeEnd":151,"githubUrl":"https://github.com/testcontainers/testcontainers-java/blob/8e549514e3f01c57d70546fbb8599d138f3903e5/modules/oracle-free/src/main/java/org/testcontainers/oracle/OracleContainer.java#L115-L151","documentation":"OracleContainer.withUsername() rejects Oracle system accounts (system, sys) case-insensitively, since tests must not connect as DBA/superuser accounts. The container throws an IllegalArgumentException listing the forbidden names.","triggerScenarios":"Calling withUsername(\"system\"), withUsername(\"SYS\"), or any case variant contained in ORACLE_SYSTEM_USERS.","commonSituations":"Copy-pasting DBA credentials from a real environment into test config; assuming admin-style users are allowed like in plain JDBC setups.","solutions":["Use a dedicated application username, e.g. withUsername(\"app_user\").","Create the needed grants for that user via an init script if extra privileges are required.","Remove config that injects 'sys'/'system' as the test username."],"exampleFix":"// before\ncontainer.withUsername(\"system\");\n// after\ncontainer.withUsername(\"app_user\");","handlingStrategy":"validation","validationCode":"java.util.Set<String> forbidden = java.util.Set.of(\"system\", \"sys\");\nif (username != null && forbidden.contains(username.toLowerCase())) {\n    throw new IllegalArgumentException(\"Use a non-system Oracle user for tests\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    container.withUsername(username);\n} catch (IllegalArgumentException e) {\n    container.withUsername(\"app_user\");\n}","preventionTips":["Never use sys/system as the application username in tests.","Validate test credential config against a deny-list of DBA accounts.","Create a dedicated app user with the needed grants via init scripts."],"tags":["oracle","validation","credentials"],"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"}