GoogleContainerTools/jib · error · IllegalArgumentException

${source} has empty tag

Error message

${source} has empty tag

What it means

JibPluginConfiguration.getTargetImageAdditionalTags validates the additional target-image tags (from <to><tags> or the jib.to.tags property) and throws IllegalArgumentException when any tag is null or empty. The message names the source: the property name (jib.to.tags) when set via property, otherwise '<to><tags>'.

Source

Thrown at jib-maven-plugin/src/main/java/com/google/cloud/tools/jib/maven/JibPluginConfiguration.java:478

    String property = getProperty(PropertyNames.TO_IMAGE);
    if (property != null) {
      return property;
    }
    return to.image;
  }

  /**
   * Gets the additional target image tags.
   *
   * @return the configured extra tags.
   */
  Set<String> getTargetImageAdditionalTags() {
    String property = getProperty(PropertyNames.TO_TAGS);
    List<String> tags =
        property != null ? ConfigurationPropertyValidator.parseListProperty(property) : to.tags;
    if (tags.stream().anyMatch(Strings::isNullOrEmpty)) {
      String source = property != null ? PropertyNames.TO_TAGS : "<to><tags>";
      throw new IllegalArgumentException(source + " has empty tag");
    }
    return new HashSet<>(tags);
  }

  /**
   * Gets the target image credential helper configuration.
   *
   * @return configuration for the target image credential helper
   */
  CredHelperConfiguration getTargetImageCredentialHelperConfig() {
    String property = getProperty(PropertyNames.TO_CRED_HELPER);
    if (property != null) {
      to.credHelper.setHelper(property);
    }
    return to.credHelper;
  }

  AuthConfiguration getTargetImageAuth() {

View on GitHub (pinned to fb949e2676)

Solutions

  1. Remove empty <tag> elements from <to><tags> in the POM.
  2. If using -Djib.to.tags, remove stray/leading/trailing commas and empty entries from the comma-separated list.
  3. If tags come from CI variables, guard the command so empty variables are dropped, e.g. filter empty values before joining with commas.
  4. Verify no tag is only whitespace; replace with a valid tag string.

Example fix

// before: mvn jib:build -Djib.to.tags=v1,,latest
// after: mvn jib:build -Djib.to.tags=v1,latest
Defensive patterns

Strategy: validation

Validate before calling

// Check tags before invoking Maven
String tags = String.join(",", candidateTags.stream().filter(t -> t != null && !t.isBlank()).toList());
if (candidateTags.size() != tags.split(",").length) throw new IllegalStateException("empty tag in jib.to.tags");

Prevention

When it happens

Trigger: Setting <to><tags><tag></tag></tags> (empty tag element) or passing -Djib.to.tags=tag1,,tag3 where parseListProperty yields an empty entry between commas; trailing/leading commas in the property value also create empty entries.

Common situations: Comma-separated property lists built from CI variables where a variable is empty, hand-edited POMs with a placeholder <tag> never filled in, or list values generated with trailing separators.

Understand the failure class

Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.

Related errors


AI-assisted analysis of GoogleContainerTools/jib@fb949e2676 (2026-09-06). Data as JSON: /api/errors/c5a9458c57c2bbb5. Report an issue: GitHub.