jenkinsci/jenkins · error · IllegalArgumentException

No such agent "{node_s}" exists. Did you mean "{adv}"?

Error message

No such agent "{node_s}" exists. Did you mean "{adv}"?

What it means

Same offline-node lookup as the no-advice case, but EditDistance.findNearest found a plausible match, so the message (Messages.Computer_NoSuchSlaveExists) appends a 'Did you mean ...?' suggestion. Fires only when getComputer returns null AND a near name exists.

Source

Thrown at core/src/main/java/hudson/cli/OfflineNodeCommand.java:72

        return Messages.OfflineNodeCommand_ShortDescription();
    }

    @Override
    protected int run() throws Exception {
        boolean errorOccurred = false;
        final Jenkins jenkins = Jenkins.get();
        final HashSet<String> hs = new HashSet<>(nodes);
        List<String> names = null;

        for (String node_s : hs) {
            try {
                Computer computer = jenkins.getComputer(node_s);
                if (computer == null) {
                    if (names == null) {
                        names = ComputerSet.getComputerNames();
                    }
                    String adv = EditDistance.findNearest(node_s, names);
                    throw new IllegalArgumentException(adv == null ?
                            hudson.model.Messages.Computer_NoSuchSlaveExistsWithoutAdvice(node_s) :
                            hudson.model.Messages.Computer_NoSuchSlaveExists(node_s, adv));
                }
                computer.cliOffline(cause);
            } catch (Exception e) {
                if (hs.size() == 1) {
                    throw e;
                }

                stderr.println(node_s + ": " + e.getMessage());
                errorOccurred = true;
                continue;
            }
        }

        if (errorOccurred) {
            throw new AbortException(CLI_LISTPARAM_SUMMARY_ERROR_TEXT);
        }

View on GitHub (pinned to 2e228ff40b)

Solutions

  1. Use the suggested name shown in the message.
  2. Confirm with `Jenkins.get().getComputers()` and re-run with the exact name.
Defensive patterns

Strategy: validation

Validate before calling

List<String> names = ComputerSet.getComputerNames();
if (!names.contains(nodeName)) {
    String near = EditDistance.findNearest(nodeName, names);
    // suggest `near` to the user / use it
}

Try / catch

catch (IllegalArgumentException e) { /* message already contains the suggestion */ }

Prevention

When it happens

Trigger: `offline-node <name>` where <name> is a typo close to a real agent name (e.g. 'agnt1' vs 'agent1').

Common situations: Minor typo in agent name; recently renamed agent whose old name is still half-remembered; case differences.

Related errors


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