{"record":{"id":"b370f74adc019580","repo":"jenkinsci/jenkins","slug":"trying-to-rename-an-item-that-does-not-support-thi","errorCode":null,"errorMessage":"Trying to rename an item that does not support this operation.","messagePattern":"Trying to rename an item that does not support this operation\\.","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/hudson/model/AbstractItem.java","lineNumber":359,"sourceCode":"     * @param newName the new name for the item\n     * @throws Failure if the rename should be blocked\n     * @since 2.110\n     * @see Job#checkRename\n     */\n    protected void checkRename(@NonNull String newName) throws Failure {\n\n    }\n\n    /**\n     * Renames this item.\n     * Not all the Items need to support this operation, but if you decide to do so,\n     * you can use this method.\n     */\n    @SuppressFBWarnings(value = \"SWL_SLEEP_WITH_LOCK_HELD\", justification = \"no big deal\")\n    protected void renameTo(final String newName) throws IOException {\n\n        if (!isNameEditable()) {\n            throw new IOException(\"Trying to rename an item that does not support this operation.\");\n        }\n\n        // always synchronize from bigger objects first\n        final ItemGroup parent = getParent();\n        String oldName = this.name;\n        String oldFullName = getFullName();\n        synchronized (parent) {\n            synchronized (this) {\n                // sanity check\n                if (newName == null)\n                    throw new IllegalArgumentException(\"New name is not given\");\n\n                // noop?\n                if (this.name.equals(newName))\n                    return;\n\n                // the lookup is case insensitive, so we should not fail if this item was the “existing” one\n                // to allow people to rename \"Foo\" to \"foo\", for example.","sourceCodeStart":341,"sourceCodeEnd":377,"githubUrl":"https://github.com/jenkinsci/jenkins/blob/2e228ff40b14dbc8b14ffbc6edf0e4383cf744fc/core/src/main/java/hudson/model/AbstractItem.java#L341-L377","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Check item.isNameEditable() before calling renameTo and skip or warn if false","If you own the Item subclass, override isNameEditable() to return true when renaming is safe"],"exampleFix":"// before\nitem.renameTo(newName);\n// after\nif (item.isNameEditable()) {\n    item.renameTo(newName);\n} else {\n    throw new IllegalStateException(item.getClass().getName() + \" does not support renaming\");\n}","handlingStrategy":"validation","validationCode":"if (!item.isNameEditable()) {\n    throw new IllegalStateException(item.getClass().getName() + \" does not support renaming\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    item.renameTo(newName);\n} catch (IOException e) {\n    if (e.getMessage().contains(\"does not support this operation\")) {\n        // item type does not allow rename; skip or inform user\n    }\n    throw e;\n}","preventionTips":["Always check isNameEditable() before calling renameTo","If you author an Item subclass, override isNameEditable() to opt into renaming","Do not expose rename UI/CLI for item types that disallow it"],"tags":["item","rename","validation","unsupported-operation"],"backgroundTag":null,"analyzedSha":"2e228ff40b14dbc8b14ffbc6edf0e4383cf744fc","analyzedAt":"2026-08-14T07:07:15.274Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}