{"record":{"id":"500cfc7e00bac071","repo":"jenkinsci/jenkins","slug":"unknown-itemgroup","errorCode":null,"errorMessage":"Unknown ItemGroup ","messagePattern":"Unknown ItemGroup ","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/hudson/cli/CopyJobCommand.java","lineNumber":68,"sourceCode":"    @Argument(metaVar = \"DST\", usage = \"Name of the new job to be created.\", index = 1, required = true)\n    @SuppressFBWarnings(value = \"PA_PUBLIC_PRIMITIVE_ATTRIBUTE\", justification = \"Preserve API compatibility\")\n    public String dst;\n\n    @Override\n    protected int run() throws Exception {\n        Jenkins jenkins = Jenkins.get();\n\n        if (jenkins.getItemByFullName(dst) != null) {\n            throw new IllegalStateException(\"Job '\" + dst + \"' already exists\");\n        }\n\n        ModifiableTopLevelItemGroup ig = jenkins;\n        int i = dst.lastIndexOf('/');\n        if (i > 0) {\n            String group = dst.substring(0, i);\n            Item item = jenkins.getItemByFullName(group);\n            if (item == null) {\n                throw new IllegalArgumentException(\"Unknown ItemGroup \" + group);\n            }\n\n            if (item instanceof ModifiableTopLevelItemGroup) {\n                ig = (ModifiableTopLevelItemGroup) item;\n            } else {\n                throw new IllegalStateException(\"Can't create job from CLI in \" + group);\n            }\n            dst = dst.substring(i + 1);\n        }\n\n        ig.copy(src, dst).save();\n        return 0;\n    }\n}\n","sourceCodeStart":50,"sourceCodeEnd":83,"githubUrl":"https://github.com/jenkinsci/jenkins/blob/2e228ff40b14dbc8b14ffbc6edf0e4383cf744fc/core/src/main/java/hudson/cli/CopyJobCommand.java#L50-L83","documentation":"`CopyJobCommand.run()` parses the destination full name; if it contains '/', the prefix before the last '/' is treated as the parent ItemGroup. If `jenkins.getItemByFullName(group)` returns null (no such item), it throws IllegalArgumentException 'Unknown ItemGroup <group>'. The parent folder/group must pre-exist.","triggerScenarios":"Running `copy-job <src> myfolder/newjob` where 'myfolder' does not exist as an item in Jenkins.","commonSituations":"Typo in the folder name; expecting the command to create folders on the fly (it does not); targeting a folder path under a nested structure where an intermediate is missing.","solutions":["Create the parent folder first (Folders plugin / CloudBees Folders): `java -jar jenkins-cli.jar create-job myfolder < folder.xml` or via the UI, then copy into it.","Correct the folder name spelling in the destination argument.","Copy to a top-level name (no '/') if a folder isn't required."],"exampleFix":"// before:\n//   java -jar jenkins-cli.jar copy-job template typo/newjob\n//   -> IllegalArgumentException: Unknown ItemGroup typo\n//\n// after: ensure the folder exists, then copy\n//   java -jar jenkins-cli.jar create-job realfolder < folder-config.xml\n//   java -jar jenkins-cli.jar copy-job template realfolder/newjob","handlingStrategy":"validation","validationCode":"// For 'folder/name' destinations, verify the parent group exists\nint i = dst.lastIndexOf('/');\nif (i > 0) {\n    String group = dst.substring(0, i);\n    if (jenkins.getItemByFullName(group) == null) {\n        throw new IllegalArgumentException(\"Unknown ItemGroup \" + group\n            + \" — create the folder first\");\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Create parent folders before copying jobs into them.","Validate each path segment of a nested destination resolves to an existing item."],"tags":["jenkins","cli","job","folder","copy"],"backgroundTag":null,"analyzedSha":"2e228ff40b14dbc8b14ffbc6edf0e4383cf744fc","analyzedAt":"2026-08-14T07:07:15.274Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}