jenkinsci/jenkins · error · IOException

Trying to rename an item that does not support this operatio

Error message

Trying to rename an item that does not support this operation.

What it means

Thrown by AbstractItem.renameTo(newName) when isNameEditable() returns false. renameTo is a protected method that subclasses opt into; the isNameEditable() guard determines whether the item type supports renaming. If a caller invokes renameTo on an item whose type does not allow renaming (e.g. certain fixed-name items), this IOException is thrown before any rename logic runs.

Source

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

     * @param newName the new name for the item
     * @throws Failure if the rename should be blocked
     * @since 2.110
     * @see Job#checkRename
     */
    protected void checkRename(@NonNull String newName) throws Failure {

    }

    /**
     * Renames this item.
     * Not all the Items need to support this operation, but if you decide to do so,
     * you can use this method.
     */
    @SuppressFBWarnings(value = "SWL_SLEEP_WITH_LOCK_HELD", justification = "no big deal")
    protected void renameTo(final String newName) throws IOException {

        if (!isNameEditable()) {
            throw new IOException("Trying to rename an item that does not support this operation.");
        }

        // always synchronize from bigger objects first
        final ItemGroup parent = getParent();
        String oldName = this.name;
        String oldFullName = getFullName();
        synchronized (parent) {
            synchronized (this) {
                // sanity check
                if (newName == null)
                    throw new IllegalArgumentException("New name is not given");

                // noop?
                if (this.name.equals(newName))
                    return;

                // the lookup is case insensitive, so we should not fail if this item was the “existing” one
                // to allow people to rename "Foo" to "foo", for example.

View on GitHub (pinned to 2e228ff40b)

Solutions

  1. Check item.isNameEditable() before calling renameTo and skip or warn if false
  2. If you own the Item subclass, override isNameEditable() to return true when renaming is safe

Example fix

// before
item.renameTo(newName);
// after
if (item.isNameEditable()) {
    item.renameTo(newName);
} else {
    throw new IllegalStateException(item.getClass().getName() + " does not support renaming");
}
Defensive patterns

Strategy: validation

Validate before calling

if (!item.isNameEditable()) {
    throw new IllegalStateException(item.getClass().getName() + " does not support renaming");
}

Try / catch

try {
    item.renameTo(newName);
} catch (IOException e) {
    if (e.getMessage().contains("does not support this operation")) {
        // item type does not allow rename; skip or inform user
    }
    throw e;
}

Prevention

When it happens

Trigger: renameTo(newName) is called on an AbstractItem whose isNameEditable() returns false. This can happen if a plugin or API path calls renameTo directly without checking editability, or if an item type overrides isNameEditable to always return false.

Common situations: Programmatic rename via Jenkins API/REST on an item type that does not support renaming; a custom Item subclass that forgot to enable name editing; attempting to rename a view or special item that has a fixed identity.

Related errors


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