jenkinsci/jenkins · error · IllegalArgumentException
No such job '
Error message
No such job '
What it means
`DeleteJobCommand.run()` looks up each job via `jenkins.getItemByFullName(job_s)`; if null it throws IllegalArgumentException 'No such job '<job_s>''. When a single job is passed the exception propagates directly (the loop's rethrow on hs.size()==1); when multiple jobs are passed the per-job error is printed to stderr and a summary AbortException follows.
Source
Thrown at core/src/main/java/hudson/cli/DeleteJobCommand.java:69
return Messages.DeleteJobCommand_ShortDescription();
}
@Override
protected int run() throws Exception {
boolean errorOccurred = false;
final Jenkins jenkins = Jenkins.get();
final HashSet<String> hs = new HashSet<>(jobs);
for (String job_s : hs) {
AbstractItem job;
try {
job = (AbstractItem) jenkins.getItemByFullName(job_s);
if (job == null) {
throw new IllegalArgumentException("No such job '" + job_s + "'");
}
job.checkPermission(Item.DELETE);
job.delete();
} catch (Exception e) {
if (hs.size() == 1) {
throw e;
}
final String errorMsg = job_s + ": " + e.getMessage();
stderr.println(errorMsg);
errorOccurred = true;
continue;
}
}
if (errorOccurred) {
throw new AbortException(CLI_LISTPARAM_SUMMARY_ERROR_TEXT);View on GitHub (pinned to 2e228ff40b)
Solutions
- Verify the exact full name (including folder path) of the job, e.g. via the Jenkins UI or `java -jar jenkins-cli.jar list-jobs` / get-job.
- For nested jobs, use the full path 'folder/job'.
- Make deletion idempotent in scripts: check existence before deleting, or treat 'no such job' as success.
Example fix
// before: // java -jar jenkins-cli.jar delete-job typoJob // -> IllegalArgumentException: No such job 'typoJob' // // after: confirm the real name (and folder path) first // java -jar jenkins-cli.jar list-jobs // java -jar jenkins-cli.jar delete-job folder/realJob
Defensive patterns
Strategy: validation
Validate before calling
// Verify job exists (full name incl. folder path) before delete-job
if (jenkins.getItemByFullName(jobName) == null) {
throw new IllegalArgumentException("No such job '" + jobName + "'");
}
// For idempotent deletion, treat 'no such job' as success instead of failing. Prevention
- Use the full name (folder/job) for nested jobs when deleting.
- Make deletion idempotent in scripts: ignore 'no such job' as a no-op success.
When it happens
Trigger: Running `java -jar jenkins-cli.jar delete-job <name>` where no item with full name <name> exists. With multiple jobs, the missing ones appear as stderr lines then the summary error (CLI_LISTPARAM_SUMMARY_ERROR_TEXT).
Common situations: Typo in the job name; job already deleted; wrong folder path for a nested job; race where the job was removed between listing and deletion.
Related errors
- Job ' already exists
- Unknown ItemGroup
- Can't create job from CLI in
- Job ' already exists
- Unknown ItemGroup
AI-assisted analysis of jenkinsci/jenkins@2e228ff40b (2026-08-14).
Data as JSON: /api/errors/3d2cf91c978a35c9.
Report an issue: GitHub.