GoogleContainerTools/jib · error · GradleException

container.workingDirectory is not an absolute Unix-style pat

Error message

container.workingDirectory is not an absolute Unix-style path: ${invalidPathValue}

What it means

Thrown when container.workingDirectory is not an absolute Unix-style path. Jib validates that the working directory configured for the container's runtime starts with '/' and contains no Windows-style components. The invalid value is included in the GradleException message.

Source

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

      PluginConfigurationProcessor.createJibBuildRunnerForDockerDaemonImage(
              new GradleRawConfiguration(jibExtension),
              ignored -> java.util.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(

View on GitHub (pinned to fb949e2676)

Solutions

  1. Use an absolute Unix path, e.g. workingDirectory = "/home/myapp"
  2. Remove drive letters and backslashes
  3. Ensure the value is non-empty and starts with '/'

Example fix

// before
jib { container { workingDirectory = 'workdir' } }
// after
jib { container { workingDirectory = '/workdir' } }
Defensive patterns

Strategy: validation

Validate before calling

def wd = jib.container.workingDirectory
if (wd != null && !wd.startsWith('/')) {
  throw new GradleException("workingDirectory must be absolute Unix path, got: $wd")
}

Try / catch

try { jibBuild.run() } catch (GradleException e) { if (e.message.contains('workingDirectory')) { logger.error(e.message) }; throw e }

Prevention

When it happens

Trigger: Setting workingDirectory in jib { container { ... } } to a relative path like 'home/user', a Windows path like 'C:\workdir', or an empty/garbage string.

Common situations: Copying Dockerfile WORKDIR conventions incorrectly, Windows-development machine path habits leaking into build configs, or typos dropping the leading slash.

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/80d0735b12b8b171. Report an issue: GitHub.