jenkinsci/jenkins · error · IllegalArgumentException

No such job '{src}'

Error message

No such job '{src}'

What it means

IllegalArgumentException from GenericItemOptionHandler when the named item is unresolved and Items.findNearest returns null (no suggestion). Same ACL caveat as the with-advice case: an item invisible to the current user is reported as 'no such job' with a WARNING log.

Source

Thrown at core/src/main/java/hudson/cli/handlers/GenericItemOptionHandler.java:77

    @Override public int parseArguments(Parameters params) throws CmdLineException {
        final Jenkins j = Jenkins.get();
        final String src = params.getParameter(0);
        T s = j.getItemByFullName(src, type());
        if (s == null) {
            final Authentication who = Jenkins.getAuthentication2();
            try (ACLContext acl = ACL.as2(ACL.SYSTEM2)) {
                Item actual = j.getItemByFullName(src);
                if (actual == null) {
                    LOGGER.log(Level.FINE, "really no item exists named {0}", src);
                } else {
                    LOGGER.log(Level.WARNING, "running as {0} could not find {1} of {2}", new Object[] {who.getPrincipal(), actual, type()});
                }
            }
            T nearest = Items.findNearest(type(), src, j);
            if (nearest != null) {
                throw new IllegalArgumentException("No such job '" + src + "'; perhaps you meant '" + nearest.getFullName() + "'?");
            } else {
                throw new IllegalArgumentException("No such job '" + src + "'");
            }
        }
        setter.addValue(s);
        return 1;
    }

    @Override public String getDefaultMetaVariable() {
        return "ITEM";
    }

}

View on GitHub (pinned to 2e228ff40b)

Solutions

  1. Check permissions — run as a user (or SYSTEM) that can read the item.
  2. Verify the item exists via getItemByFullName.
  3. Correct the name/path.
Defensive patterns

Strategy: validation

Validate before calling

Item it = Jenkins.get().getItemByFullName(name);
if (it == null) {
    try (ACLContext ctx = ACL.as2(ACL.SYSTEM2)) {
        boolean reallyMissing = Jenkins.get().getItemByFullName(name) == null;
    }
}

Try / catch

catch (IllegalArgumentException e) { /* distinguish missing vs. no-permission via SYSTEM2 lookup */ }

Prevention

When it happens

Trigger: An ITEM CLI option whose name does not match any item and has no near match, or matches only items the current user cannot read.

Common situations: Wrong/renamed job name; insufficient permissions; job in a folder the user cannot traverse.

Related errors


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