{"record":{"id":"a09fb7b0d3af507d","repo":"jenkinsci/jenkins","slug":"invalid-view-name","errorCode":null,"errorMessage":"Invalid view name: ","messagePattern":"Invalid view name: ","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/hudson/cli/CreateViewCommand.java","lineNumber":60,"sourceCode":"\n    @Override\n    public String getShortDescription() {\n\n        return Messages.CreateViewCommand_ShortDescription();\n    }\n\n    @Override\n    protected int run() throws Exception {\n\n        final Jenkins jenkins = Jenkins.get();\n        jenkins.checkPermission(View.CREATE);\n\n        View newView;\n        try {\n\n            newView = View.createViewFromXML(viewName, stdin);\n        } catch (Failure ex) {\n            throw new IllegalArgumentException(\"Invalid view name: \" + ex.getMessage());\n        }\n\n        final String newName = newView.getViewName();\n        if (jenkins.getView(newName) != null) {\n            throw new IllegalStateException(\"View '\" + newName + \"' already exists\");\n        }\n\n        jenkins.addView(newView);\n\n        return 0;\n    }\n}\n","sourceCodeStart":42,"sourceCodeEnd":73,"githubUrl":"https://github.com/jenkinsci/jenkins/blob/2e228ff40b14dbc8b14ffbc6edf0e4383cf744fc/core/src/main/java/hudson/cli/CreateViewCommand.java#L42-L73","documentation":"`CreateViewCommand.run()` calls `View.createViewFromXML(viewName, stdin)` inside a try; if it throws a `hudson.model.Failure` (view-name validation failure — illegal characters, reserved name, etc.), the catch rethrows it as IllegalArgumentException 'Invalid view name: <Failure.message>'. The Failure is the model-level validation result for the view name.","triggerScenarios":"Running `java -jar jenkins-cli.jar create-view <name> < view.xml` where <name> (or the name in the XML) fails View's name validation — e.g. contains characters not allowed in view names, is empty, or collides with a reserved identifier.","commonSituations":"Special characters, spaces, or slashes in the view name; very long names; names conflicting with built-in views.","solutions":["Use a valid view name: alphanumeric with safe separators, no slashes or reserved tokens.","Pass the name via the argument to override a bad name embedded in the XML, or fix the XML.","Check Jenkins' view-name rules (similar to job-name rules: no '/', no leading '.', etc.) before creating."],"exampleFix":"// before:\n//   java -jar jenkins-cli.jar create-view 'my/view' < view.xml\n//   -> IllegalArgumentException: Invalid view name: ... (slash not allowed)\n//\n// after: use a permitted name\n//   java -jar jenkins-cli.jar create-view myView < view.xml","handlingStrategy":"validation","validationCode":"// Validate the view name the same way View.createViewFromXML does before creating\ntry {\n    Jenkins.checkGoodName(viewName); // reuse Jenkins' name rules as a first guard\n} catch (Failure f) {\n    throw new IllegalArgumentException(\"Invalid view name: \" + f.getMessage());\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Restrict view names to alphanumeric characters and safe separators; avoid '/', leading '.', and reserved tokens.","Pass the name via the argument rather than embedding an invalid one in the XML."],"tags":["jenkins","cli","view","validation","create"],"backgroundTag":null,"analyzedSha":"2e228ff40b14dbc8b14ffbc6edf0e4383cf744fc","analyzedAt":"2026-08-14T07:07:15.274Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}