GoogleContainerTools/jib · error · MojoExecutionException

<container><filesModificationTime> should be an ISO 8601 dat

Error message

<container><filesModificationTime> should be an ISO 8601 date-time (see DateTimeFormatter.ISO_DATE_TIME) or special keyword "EPOCH_PLUS_SECOND": <invalidFilesModificationTime>

What it means

<container><filesModificationTime> accepts either an ISO 8601 date-time (DateTimeFormatter.ISO_DATE_TIME format) or the special keyword "EPOCH_PLUS_SECOND". Any other string causes InvalidFilesModificationTimeException, which BuildDockerMojo.execute() wraps in a MojoExecutionException echoing the invalid value.

Source

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

    } catch (InvalidFilesModificationTimeException ex) {
      throw new MojoExecutionException(
          "<container><filesModificationTime> should be an ISO 8601 date-time (see "
              + "DateTimeFormatter.ISO_DATE_TIME) or special keyword \"EPOCH_PLUS_SECOND\": "
              + ex.getInvalidFilesModificationTime(),
          ex);

    } catch (InvalidCreationTimeException ex) {
      throw new MojoExecutionException(
          "<container><creationTime> should be an ISO 8601 date-time (see "
              + "DateTimeFormatter.ISO_DATE_TIME) or a special keyword (\"EPOCH\", "
              + "\"USE_CURRENT_TIMESTAMP\"): "
              + ex.getInvalidCreationTime(),
          ex);

    } catch (JibPluginExtensionException ex) {
      String extensionName = ex.getExtensionClass().getName();
      throw new MojoExecutionException(
          "error running extension '" + extensionName + "': " + ex.getMessage(), ex);

    } catch (IncompatibleBaseImageJavaVersionException ex) {
      throw new MojoExecutionException(
          HelpfulSuggestions.forIncompatibleBaseImageJavaVersionForMaven(
              ex.getBaseImageMajorJavaVersion(), ex.getProjectMajorJavaVersion()),
          ex);

    } catch (InvalidImageReferenceException ex) {
      throw new MojoExecutionException(
          HelpfulSuggestions.forInvalidImageReference(ex.getInvalidReference()), ex);

    } catch (IOException
        | CacheDirectoryCreationException
        | MainClassInferenceException
        | InvalidGlobalConfigException ex) {
      throw new MojoExecutionException(ex.getMessage(), ex);

View on GitHub (pinned to fb949e2676)

Solutions

  1. Use an ISO 8601 date-time such as 2024-01-15T10:00:00Z or the keyword EPOCH_PLUS_SECOND.
  2. Format the date with DateTimeFormatter.ISO_DATE_TIME (e.g. 2024-01-15T10:00:00+02:00) — no slashes or space-separated dates.
  3. If you meant a fixed EPOCH time, use the literal ISO value 1970-01-01T00:00:00Z instead of the keyword 'EPOCH', which is only valid for <creationTime>.

Example fix

<!-- before -->
<container><filesModificationTime>now</filesModificationTime></container>
<!-- after -->
<container><filesModificationTime>2024-01-15T10:00:00Z</filesModificationTime></container>
Defensive patterns

Strategy: validation

Validate before calling

String t = pomFilesModificationTime;
if (t != null && !t.equals("EPOCH_PLUS_SECOND")) {
  java.time.format.DateTimeFormatter.ISO_DATE_TIME.parse(t); // throws if not ISO 8601
}

Type guard

boolean isValidFilesModificationTime(String t) {
  return t == null || t.equals("EPOCH_PLUS_SECOND") || tryParseIso(t);
}

Prevention

When it happens

Trigger: Setting <filesModificationTime> to values like 'now', a non-ISO format such as '2024/01/15 10:00:00', an empty string, or a misspelled keyword, then running any jib goal.

Common situations: Trying to set reproducible build timestamps with human-readable dates; confusing this option with <creationTime> whose keywords (EPOCH, USE_CURRENT_TIMESTAMP) don't apply here; copying a Dockerfile LABEL-style date format.

Related errors


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