GoogleContainerTools/jib · error · GradleException

container.filesModificationTime should be an ISO 8601 date-t

Error message

container.filesModificationTime should be an ISO 8601 date-time (see DateTimeFormatter.ISO_DATE_TIME) or special keyword "EPOCH_PLUS_SECOND": ${ex.getInvalidFilesModificationTime()}

What it means

This is the same InvalidFilesModificationTimeException surfacing as error 147: container.filesModificationTime must be an ISO 8601 date-time (DateTimeFormatter.ISO_DATE_TIME) or the keyword EPOCH_PLUS_SECOND. The Gradle task wraps the exception in a GradleException whose message interpolates ex.getInvalidFilesModificationTime(), echoing the exact rejected value.

Source

Thrown at jib-gradle-plugin/src/main/java/com/google/cloud/tools/jib/gradle/BuildImageTask.java:150

    } catch (InvalidWorkingDirectoryException ex) {
      throw new GradleException(
          "container.workingDirectory is not an absolute Unix-style path: "
              + ex.getInvalidPathValue(),
          ex);
    } catch (InvalidPlatformException ex) {
      throw new GradleException(
          "from.platforms contains a platform configuration that is missing required values or has invalid values: "
              + ex.getMessage()
              + ": "
              + ex.getInvalidPlatform(),
          ex);

    } catch (InvalidContainerVolumeException ex) {
      throw new GradleException(
          "container.volumes is not an absolute Unix-style path: " + ex.getInvalidVolume(), ex);

    } catch (InvalidFilesModificationTimeException ex) {
      throw new GradleException(
          "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 GradleException(
          "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 GradleException(
          "error running extension '" + extensionName + "': " + ex.getMessage(), ex);

View on GitHub (pinned to fb949e2676)

Solutions

  1. Provide an ISO 8601 date-time with timezone, e.g. '2024-06-01T12:00:00Z'.
  2. Use EPOCH_PLUS_SECOND for reproducible builds.
  3. Delete the property to accept the default.

Example fix

// before
jib {
  container { filesModificationTime = 'now' }
}
// after
jib {
  container { filesModificationTime = 'EPOCH_PLUS_SECOND' }
}
Defensive patterns

Strategy: validation

Validate before calling

def fmt = jib.container.filesModificationTime
if (fmt != null && fmt != 'EPOCH_PLUS_SECOND') {
  try { java.time.OffsetDateTime.parse(fmt) }
  catch (Exception e) { throw new GradleException("filesModificationTime invalid: $fmt") }
}

Try / catch

try {
  tasks.named('jib').get().execute()
} catch (GradleException e) {
  if (e.message?.contains('filesModificationTime')) {
    logger.error("Rejected value was: ${e.message}")
  }
  throw e
}

Prevention

When it happens

Trigger: Running a jib build task when jib.container.filesModificationTime (or -Djib.container.filesModificationTime) holds a string that fails ISO 8601 parsing and is not EPOCH_PLUS_SECOND.

Common situations: Same as the parent family: locale-formatted dates, missing timezone designator ('2024-01-01T00:00:00' without Z is usually accepted by ISO_DATE_TIME, but formats with slashes or 'now' are not), or property files injecting malformed values.

Related errors


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