{"record":{"id":"c034b01db285fa49","repo":"jenkinsci/jenkins","slug":"0-is-not-an-allowed-name","errorCode":null,"errorMessage":"“{0}” is not an allowed name","messagePattern":"“(.+?)” is not an allowed name","errorType":"validation","errorClass":"Failure","httpStatus":null,"severity":"warning","filePath":"core/src/main/java/hudson/model/AbstractItem.java","lineNumber":323,"sourceCode":"     * Check new name for job\n     * @param newName - New name for job.\n     */\n    private void checkIfNameIsUsed(@NonNull String newName) throws Failure {\n        try {\n            Item item = getParent().getItem(newName);\n            if (item != null) {\n                throw new Failure(Messages.AbstractItem_NewNameInUse(newName));\n            }\n            try (ACLContext ctx = ACL.as2(ACL.SYSTEM2)) {\n                item = getParent().getItem(newName);\n                if (item != null) {\n                    if (LOGGER.isLoggable(Level.FINE)) {\n                        LOGGER.log(Level.FINE, \"Unable to rename the job {0}: name {1} is already in use. \" +\n                                \"User {2} has no {3} permission for existing job with the same name\",\n                                new Object[] {this.getFullName(), newName, ctx.getPreviousContext2().getAuthentication().getName(), Item.DISCOVER.name});\n                    }\n                    // Don't explicitly mention that there is another item with the same name.\n                    throw new Failure(Messages.Jenkins_NotAllowedName(newName));\n                }\n            }\n        } catch (AccessDeniedException ex) {\n            if (LOGGER.isLoggable(Level.FINE)) {\n                LOGGER.log(Level.FINE, \"Unable to rename the job {0}: name {1} is already in use. \" +\n                        \"User {2} has {3} permission, but no {4} for existing job with the same name\",\n                        new Object[] {this.getFullName(), newName, User.current(), Item.DISCOVER.name, Item.READ.name});\n            }\n            throw new Failure(Messages.AbstractItem_NewNameInUse(newName));\n        }\n    }\n\n    /**\n     * Allows subclasses to block renames for domain-specific reasons. Generic validation of the new name\n     * (e.g., null checking, checking for illegal characters, and checking that the name is not in use)\n     * always happens prior to calling this method.\n     *\n     * @param newName the new name for the item","sourceCodeStart":305,"sourceCodeEnd":341,"githubUrl":"https://github.com/jenkinsci/jenkins/blob/2e228ff40b14dbc8b14ffbc6edf0e4383cf744fc/core/src/main/java/hudson/model/AbstractItem.java#L305-L341","documentation":"Thrown by checkIfNameIsUsed(newName) when, after elevating to SYSTEM2, getItem(newName) returns non-null but the original user could NOT see that item (no DISCOVER permission). To avoid leaking the existence of a hidden item, Jenkins reports the generic 'NotAllowedName' message instead of revealing the collision. This is an intentional information-disclosure guard.","triggerScenarios":"A user without DISCOVER permission on an existing same-named item attempts to rename to that name; the first getItem (as the user) throws AccessDeniedException or returns null, but the SYSTEM2-elevated getItem finds the hidden item, triggering the NotAllowedName Failure.","commonSituations":"A lower-privilege user tries to create/rename to a name that collides with a restricted/hidden job they cannot see; folder-level ACLs hide certain items from a user; matrix-based security restricting DISCOVER.","solutions":["Grant the user DISCOVER (and ideally READ) permission on the conflicting item if appropriate","Choose a different name that does not collide with any hidden item","Have an admin perform the rename if the collision is with a restricted item the user should not see","Review folder/item security to confirm hidden items are intentional"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Run as SYSTEM to detect hidden collisions without leaking to the user\nboolean collides;\ntry (ACLContext ctx = ACL.as2(ACL.SYSTEM2)) {\n    collides = item.getParent().getItem(newName) != null;\n}\nif (collides) {\n    // name collides with a restricted item; suggest a different name without revealing details\n}","typeGuard":null,"tryCatchPattern":"try {\n    // rename flow\n} catch (Failure f) {\n    if (f.getMessage().contains(\"not an allowed name\")) {\n        // likely a hidden collision or disallowed name; suggest alternatives\n    }\n    throw f;\n}","preventionTips":["Review DISCOVER/READ permissions on items that should or should not be visible to users","When rename fails with 'not an allowed name', suspect a hidden-item collision","Have an admin perform renames involving restricted items"],"tags":["item","rename","naming","permissions","security","discover","acl"],"backgroundTag":null,"analyzedSha":"2e228ff40b14dbc8b14ffbc6edf0e4383cf744fc","analyzedAt":"2026-08-14T07:07:15.274Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}