jenkinsci/jenkins · warning · Failure

“ ” is not an allowed name

Error message

“{0}” is not an allowed name

What it means

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.

Solutions

  1. Grant the user DISCOVER (and ideally READ) permission on the conflicting item if appropriate
  2. Choose a different name that does not collide with any hidden item
  3. Have an admin perform the rename if the collision is with a restricted item the user should not see
  4. Review folder/item security to confirm hidden items are intentional
Defensive patterns

Strategy: validation

Validate before calling

// Run as SYSTEM to detect hidden collisions without leaking to the user
boolean collides;
try (ACLContext ctx = ACL.as2(ACL.SYSTEM2)) {
    collides = item.getParent().getItem(newName) != null;
}
if (collides) {
    // name collides with a restricted item; suggest a different name without revealing details
}

Try / catch

try {
    // rename flow
} catch (Failure f) {
    if (f.getMessage().contains("not an allowed name")) {
        // likely a hidden collision or disallowed name; suggest alternatives
    }
    throw f;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of jenkinsci/jenkins@2e228ff40b (2026-08-14). Data as JSON: /api/errors/c034b01db285fa49. Report an issue: GitHub.

Appendix: source

Thrown at core/src/main/java/hudson/model/AbstractItem.java:323

     * Check new name for job
     * @param newName - New name for job.
     */
    private void checkIfNameIsUsed(@NonNull String newName) throws Failure {
        try {
            Item item = getParent().getItem(newName);
            if (item != null) {
                throw new Failure(Messages.AbstractItem_NewNameInUse(newName));
            }
            try (ACLContext ctx = ACL.as2(ACL.SYSTEM2)) {
                item = getParent().getItem(newName);
                if (item != null) {
                    if (LOGGER.isLoggable(Level.FINE)) {
                        LOGGER.log(Level.FINE, "Unable to rename the job {0}: name {1} is already in use. " +
                                "User {2} has no {3} permission for existing job with the same name",
                                new Object[] {this.getFullName(), newName, ctx.getPreviousContext2().getAuthentication().getName(), Item.DISCOVER.name});
                    }
                    // Don't explicitly mention that there is another item with the same name.
                    throw new Failure(Messages.Jenkins_NotAllowedName(newName));
                }
            }
        } catch (AccessDeniedException ex) {
            if (LOGGER.isLoggable(Level.FINE)) {
                LOGGER.log(Level.FINE, "Unable to rename the job {0}: name {1} is already in use. " +
                        "User {2} has {3} permission, but no {4} for existing job with the same name",
                        new Object[] {this.getFullName(), newName, User.current(), Item.DISCOVER.name, Item.READ.name});
            }
            throw new Failure(Messages.AbstractItem_NewNameInUse(newName));
        }
    }

    /**
     * Allows subclasses to block renames for domain-specific reasons. Generic validation of the new name
     * (e.g., null checking, checking for illegal characters, and checking that the name is not in use)
     * always happens prior to calling this method.
     *
     * @param newName the new name for the item

View on GitHub (pinned to 2e228ff40b)