jenkinsci/jenkins · error · IllegalArgumentException

Not sure what you meant by "%s". Did you mean "%s"?

Error message

Not sure what you meant by "%s". Did you mean "%s"?

What it means

Same ConsoleCommand branch as error 88, but `findNearest(build)` returned a non-null suggestion, so the message includes 'Did you mean "<nearest>"?'. This means the token was a near-miss of a real permalink ID (edit-distance match), guiding the user to the correct spelling.

Source

Thrown at core/src/main/java/hudson/cli/ConsoleCommand.java:62

        job.checkPermission(Item.READ);

        Run<?, ?> run;

        try {
            int n = Integer.parseInt(build);
            run = job.getBuildByNumber(n);
            if (run == null)
                throw new IllegalArgumentException("No such build #" + n);
        } catch (NumberFormatException e) {
            // maybe a permalink?
            Permalink p = job.getPermalinks().get(build);
            if (p != null) {
                run = p.resolve(job);
                if (run == null)
                    throw new IllegalStateException("Permalink " + build + " produced no build", e);
            } else {
                Permalink nearest = job.getPermalinks().findNearest(build);
                throw new IllegalArgumentException(nearest == null ?
                        String.format("Not sure what you meant by \"%s\".", build) :
                        String.format("Not sure what you meant by \"%s\". Did you mean \"%s\"?",
                                build, nearest.getId()), e);
            }
        }

        OutputStreamWriter w = new OutputStreamWriter(stdout, getClientCharset());
        try {
            long pos = n >= 0 ? seek(run) : 0;

            if (follow) {
                AnnotatedLargeText logText;
                do {
                    logText = run.getLogText();
                    pos = logText.writeLogTo(pos, w);
                    // TODO should sleep as in Run.writeWholeLogTo
                } while (!logText.isComplete());
            } else {

View on GitHub (pinned to 2e228ff40b)

Solutions

  1. Use the suggested permalink exactly as printed (the 'Did you mean' hint).
  2. Use a numeric build number to avoid permalink spelling entirely.
  3. Default to lastBuild by omitting the argument.

Example fix

// before:
//   java -jar jenkins-cli.jar console myjob lastBuilds
//   -> Not sure what you meant by "lastBuilds". Did you mean "lastBuild"?
//
// after: use the suggested permalink
//   java -jar jenkins-cli.jar console myjob lastBuild
Defensive patterns

Strategy: validation

Validate before calling

// Surface the nearest permalink suggestion before the CLI rejects the token
Permalink nearest = job.getPermalinks().findNearest(buildArg);
if (nearest != null && !isRegisteredPermalink(job, buildArg)) {
    throw new IllegalArgumentException(
        "Unknown build specifier '" + buildArg + "'. Did you mean '" + nearest.getId() + "'?");
}

Prevention

When it happens

Trigger: Running `console <job> <typo>` where the typo is close to a registered permalink, e.g. 'lastBuilds' (extra s), 'lastSucessfulBuild' (missing c), or 'lastStableBuilds'.

Common situations: Minor misspelling of a standard permalink; casing differences; pluralizing a permalink name.

Related errors


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