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": ${invalidFilesModificationTime}

What it means

container.filesModificationTime accepts either an ISO 8601 date-time (parsed with DateTimeFormatter.ISO_DATE_TIME) or the special keyword EPOCH_PLUS_SECOND; it controls the modification timestamps assigned to files added to the image. InvalidFilesModificationTimeException is thrown for any other value, and the Gradle task rethrows it as this GradleException.

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. Use a valid ISO 8601 date-time, e.g. '2024-01-01T00:00:00Z'.
  2. Use the special keyword EPOCH_PLUS_SECOND if a deterministic constant timestamp is wanted.
  3. Remove the setting to use the default (EPOCH_PLUS_SECOND behavior).

Example fix

// before
jib {
  container { filesModificationTime = '2024/01/01' }
}
// after
jib {
  container { filesModificationTime = '2024-01-01T00:00:00Z' }
}
Defensive patterns

Strategy: validation

Validate before calling

def fmt = jib.container.filesModificationTime
if (fmt != null && fmt != 'EPOCH_PLUS_SECOND') {
  try { java.time.format.DateTimeFormatter.ISO_DATE_TIME.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?.startsWith('container.filesModificationTime should be')) {
    logger.error("Use ISO 8601 date-time or EPOCH_PLUS_SECOND: ${e.message}")
  }
  throw e
}

Prevention

When it happens

Trigger: Setting jib.container.filesModificationTime to a non-ISO string like '2024/01/01', 'now', or an empty value and running a jib build task.

Common situations: Using human-readable date formats; expecting a 'now' keyword that doesn't exist; time-zone-less formats that ISO_DATE_TIME rejects (e.g. '2024-01-01 00:00:00'); copying config from another tool with different accepted formats.

Related errors


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