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

Thrown when container.filesModificationTime is not a valid ISO 8601 date-time (DateTimeFormatter.ISO_DATE_TIME) nor the special keyword 'EPOCH_PLUS_SECOND'. This setting controls the modification timestamps assigned to files added to the image.

Source

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

      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 an ISO 8601 date-time string, e.g. filesModificationTime = "2024-01-15T10:00:00Z"
  2. Or use the keyword 'EPOCH_PLUS_SECOND' for reproducible builds
  3. Fix the date format to match DateTimeFormatter.ISO_DATE_TIME

Example fix

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

Strategy: validation

Validate before calling

def t = jib.container.filesModificationTime
if (t != null && !(t in ['EPOCH_PLUS_SECOND']) && !isValidIsoDateTime(t)) {
  throw new GradleException("filesModificationTime must be ISO 8601 or EPOCH_PLUS_SECOND: $t")
}

Try / catch

try { jibBuild.run() } catch (GradleException e) { if (e.message.contains('filesModificationTime')) { logger.error(e.message + " — use ISO 8601 or EPOCH_PLUS_SECOND") }; throw e }

Prevention

When it happens

Trigger: Setting filesModificationTime to a non-ISO string like 'now', '2024/01/15 10:00:00', a epoch number, or an unrecognized keyword.

Common situations: Trying to set timestamps to 'now' or a unix epoch integer, using locale-formatted dates, or confusing this option with container.creationTime's keyword set ('EPOCH' vs 'EPOCH_PLUS_SECOND').

Related errors


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