jenkinsci/jenkins · error · IllegalArgumentException

Illegal dependency specifier {0}

Error message

Illegal dependency specifier {0}

What it means

IllegalArgumentException thrown by the Dependency constructor when the dependency specifier string does not contain a ':' separator. The expected format is 'shortName:version' (e.g., 'git:4.0.0'). Without a colon, the constructor cannot split the name from the version.

Source

Thrown at core/src/main/java/hudson/PluginWrapper.java:466

    @Restricted(NoExternalUse.class) // Jelly use only
    public String getHealthScoreClass() {
        if (this.healthScore == null) return null;
        return getHealthScoreClassForScore(this.healthScore);
    }

    @ExportedBean
    public static final class Dependency {
        @Exported
        public final String shortName;
        @Exported
        public final String version;
        @Exported
        public final boolean optional;

        public Dependency(String s) {
            int idx = s.indexOf(':');
            if (idx == -1)
                throw new IllegalArgumentException("Illegal dependency specifier " + s);
            this.shortName = Util.intern(s.substring(0, idx));
            String version = Util.intern(s.substring(idx + 1));

            boolean isOptional = false;
            String[] osgiProperties = version.split("[;]");
            for (int i = 1; i < osgiProperties.length; i++) {
                String osgiProperty = osgiProperties[i].trim();
                if (osgiProperty.equalsIgnoreCase("resolution:=optional")) {
                    isOptional = true;
                    break;
                }
            }
            this.optional = isOptional;
            if (isOptional) {
                this.version = osgiProperties[0];
            } else {
                this.version = version;
            }

View on GitHub (pinned to 2e228ff40b)

Solutions

  1. Ensure dependency specifiers use 'shortName:version' format.
  2. Fix the plugin's POM dependency declarations that generate the manifest.
  3. Validate dependency strings before constructing Dependency objects.

Example fix

// before
new PluginWrapper.Dependency("git");

// after
new PluginWrapper.Dependency("git:4.0.0");
Defensive patterns

Strategy: validation

Validate before calling

public static boolean isValidDependencySpecifier(String s) {
    return s != null && s.indexOf(':') != -1;
}

Type guard

public static boolean isValidDependencySpecifier(String s) {
    if (s == null || s.isEmpty()) return false;
    int idx = s.indexOf(':');
    return idx > 0 && idx < s.length() - 1;
}

Try / catch

try {
    PluginWrapper.Dependency dep = new PluginWrapper.Dependency(spec);
} catch (IllegalArgumentException e) {
    throw new IllegalArgumentException("Invalid dependency specifier '" + spec + "'; expected 'name:version'", e);
}

Prevention

When it happens

Trigger: Constructing a new PluginWrapper.Dependency from a string that has no ':' character — e.g., 'git', 'git-4.0.0', or an empty string. Typically parsed from plugin manifest dependencies or config.xml.

Common situations: A plugin manifest with a malformed dependency entry, manually edited dependency declarations, or a plugin build tool producing incorrect MANIFEST.MF dependency specifiers.

Related errors


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