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

container.workingDirectory must be an absolute Unix-style path (e.g. /workspace) because it becomes the WORKDIR in the image. Jib throws InvalidWorkingDirectoryException when the configured value is relative or not a Unix path, and the Gradle task wraps it in this GradleException.

Source

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

      PluginConfigurationProcessor.createJibBuildRunnerForRegistryImage(
              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. Use a fully qualified Unix path with a leading slash, e.g. workingDirectory = '/app'.
  2. Remove workingDirectory to fall back to Jib's default work directory.
  3. Normalize any Windows path input in scripts that generate the config.

Example fix

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

Strategy: validation

Validate before calling

def wd = jib.container.workingDirectory
if (wd != null && !(wd ==~ '^/[A-Za-z0-9._/-]+$')) {
  throw new GradleException("workingDirectory must be an absolute Unix path, got: $wd")
}

Try / catch

try {
  tasks.named('jib').get().execute()
} catch (GradleException e) {
  if (e.message?.startsWith('container.workingDirectory is not')) {
    logger.error("Fix workingDirectory (must start with '/'): ${e.message}")
  }
  throw e
}

Prevention

When it happens

Trigger: Setting jib.container.workingDirectory to a relative path ('workspace'), an empty string, or a Windows-style path, then running any jib build task.

Common situations: Windows developers entering 'C:\\workdir' or backslash paths; forgetting the leading slash; copying Dockerfile WORKDIR syntax with relative paths; programmatic plugin usage passing null-like or relative values from another config source.

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