{"record":{"id":"942a9050d28949db","repo":"jenkinsci/jenkins","slug":"error-occurred-while-performing-this-command-see","errorCode":null,"errorMessage":"Error occurred while performing this command, see previous stderr output.","messagePattern":"Error occurred while performing this command, see previous stderr output\\.","errorType":"exception","errorClass":"AbortException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/hudson/cli/ConnectNodeCommand.java","lineNumber":80,"sourceCode":"\n        for (String node_s : hs) {\n            try {\n                Computer computer = Computer.resolveForCLI(node_s);\n                computer.cliConnect(force);\n            } catch (Exception e) {\n                if (hs.size() == 1) {\n                    throw e;\n                }\n\n                final String errorMsg = node_s + \": \" + e.getMessage();\n                stderr.println(errorMsg);\n                errorOccurred = true;\n                continue;\n            }\n        }\n\n        if (errorOccurred) {\n            throw new AbortException(CLI_LISTPARAM_SUMMARY_ERROR_TEXT);\n        }\n        return 0;\n    }\n}\n","sourceCodeStart":62,"sourceCodeEnd":85,"githubUrl":"https://github.com/jenkinsci/jenkins/blob/2e228ff40b14dbc8b14ffbc6edf0e4383cf744fc/core/src/main/java/hudson/cli/ConnectNodeCommand.java#L62-L85","documentation":"The constant `CLI_LISTPARAM_SUMMARY_ERROR_TEXT` ('Error occurred while performing this command, see previous stderr output.') is thrown as an AbortException by `ConnectNodeCommand.run()` after iterating a comma-separated list of agents when at least one failed. Per-node failures are caught, printed to stderr as `'<node>: <message>'`, and set `errorOccurred`; after the loop the summary abort terminates the command with a non-zero exit. It is shared by all multi-valued node/job CLI commands.","triggerScenarios":"Running `java -jar jenkins-cli.jar connect-node nodeA,nodeB,nodeC` (more than one node) where at least one `Computer.resolveForCLI(node_s)` or `computer.cliConnect(force)` throws (unknown node, agent launch failure, already-connected). With exactly one node the original exception is rethrown instead.","commonSituations":"Typo'd agent names, agents that are offline/unreachable, launchers misconfigured, mixed valid/invalid node names in a batch reconnect.","solutions":["Read the preceding stderr lines: each prints `<node>: <root message>` identifying which node failed and why; fix those specific nodes.","Retry the failed nodes individually (`connect-node <singleNode>`) to get the precise exception instead of the summary.","Validate node names exist (`jenkins get-node` / the nodes view) and confirm the agent launch configuration before batch reconnecting."],"exampleFix":"// before: batch reconnect hides per-node cause in summary\n//   java -jar jenkins-cli.jar connect-node agent1,agent2,typoAgent\n//   -> AbortException: 'Error occurred while performing this command...'\n//\n// after: run failing node alone to see the real error, then reconnect the batch\n//   java -jar jenkins-cli.jar connect-node typoAgent\n//   java -jar jenkins-cli.jar connect-node agent1,agent2","handlingStrategy":"try-catch","validationCode":"// Validate node names exist before batch connecting:\n//   for n in nodeA,nodeB,nodeC; do java -jar jenkins-cli.jar get-node \"$n\" >/dev/null || echo \"missing: $n\"; done","typeGuard":null,"tryCatchPattern":"// Multi-node commands print per-node errors to stderr then abort;\n// capture stderr to map failures back to nodes.\nProcess p = new ProcessBuilder(\"java\", \"-jar\", \"jenkins-cli.jar\",\n        \"connect-node\", String.join(\",\", nodes)).redirectErrorStream(false).start();\nint rc = p.waitFor();\nList<String> nodeErrors = readLines(p.getErrorStream()); // each: \"<node>: <msg>\"\nif (rc != 0 && nodeErrors.stream().noneMatch(l -> l.contains(CLI_LISTPARAM_SUMMARY_ERROR_TEXT))) {\n    // not just a summary; rethrow/log the real per-node causes\n}","preventionTips":["When batch node ops fail, always read stderr to find the specific failing node.","Retry failing nodes individually to obtain the precise exception type and message."],"tags":["jenkins","cli","node","batch","agent"],"backgroundTag":null,"analyzedSha":"2e228ff40b14dbc8b14ffbc6edf0e4383cf744fc","analyzedAt":"2026-08-14T07:07:15.274Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}