GoogleContainerTools/jib · error · GradleException

container.workingDirectory is not an absolute Unix-style pat

Error message

container.workingDirectory is not an absolute Unix-style path: ${ex.getInvalidPathValue()}

What it means

Jib validates that container.workingDirectory is an absolute Unix-style path (leading '/', forward slashes) when building the tarball; InvalidWorkingDirectoryException is thrown otherwise and wrapped in this GradleException with the offending value.

Source

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

    try {
      PluginConfigurationProcessor.createJibBuildRunnerForTarImage(
              new GradleRawConfiguration(jibExtension),
              ignored -> Optional.empty(),
              projectProperties,
              globalConfig,
              new GradleHelpfulSuggestions(HELPFUL_SUGGESTIONS_PREFIX))
          .runBuild();

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

    } catch (InvalidContainerizingModeException ex) {
      throw new GradleException(
          "invalid value for containerizingMode: " + ex.getInvalidContainerizingMode(), ex);

    } 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 "

View on GitHub (pinned to fb949e2676)

Solutions

  1. Make the value absolute Unix-style, e.g. jib { container { workingDirectory = '/work' } }
  2. Use forward slashes only; remove drive letters/backslashes
  3. Remove the workingDirectory setting if the default is acceptable

Example fix

// before
jib { container { workingDirectory = 'home/app/work' } }
// after
jib { container { workingDirectory = '/home/app/work' } }
Defensive patterns

Strategy: validation

Validate before calling

def wd = project.jib.container.workingDirectory.getOrElse('')
if (wd && !(wd ==~ /^\/[^\0]+/)) throw new GradleException("container.workingDirectory must be absolute Unix path: $wd")

Prevention

When it happens

Trigger: Running gradle jibBuildTar with jib { container { workingDirectory = 'work' } } (relative) or a Windows-style path, or a value without a leading slash.

Common situations: Setting a relative working directory for the container process; Windows-developer path habits ('C:\\work'); editing config and dropping the leading '/'; copying Docker WORKDIR-style relative values.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


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