GoogleContainerTools/jib · error · MojoExecutionException

<container><workingDirectory> is not an absolute Unix-style

Error message

<container><workingDirectory> is not an absolute Unix-style path: <invalidPathValue>

What it means

Jib validates <container><workingDirectory>, which sets the WORKDIR of the built container. If the value is not an absolute Unix-style path (leading '/'), InvalidWorkingDirectoryException is thrown and execute() rethrows it as a MojoExecutionException that includes the offending value.

Source

Thrown at jib-maven-plugin/src/main/java/com/google/cloud/tools/jib/maven/BuildImageMojo.java:129

              new MavenRawConfiguration(this),
              new MavenSettingsServerCredentials(
                  getSession().getSettings(), getSettingsDecrypter()),
              projectProperties,
              globalConfig,
              new MavenHelpfulSuggestions(HELPFUL_SUGGESTIONS_PREFIX))
          .runBuild();

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

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

    } catch (InvalidWorkingDirectoryException ex) {
      throw new MojoExecutionException(
          "<container><workingDirectory> is not an absolute Unix-style path: "
              + ex.getInvalidPathValue(),
          ex);
    } catch (InvalidPlatformException ex) {
      throw new MojoExecutionException(
          "<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 MojoExecutionException(
          "<container><volumes> is not an absolute Unix-style path: " + ex.getInvalidVolume(), ex);

    } catch (InvalidFilesModificationTimeException ex) {
      throw new MojoExecutionException(
          "<container><filesModificationTime> should be an ISO 8601 date-time (see "
              + "DateTimeFormatter.ISO_DATE_TIME) or special keyword \"EPOCH_PLUS_SECOND\": "

View on GitHub (pinned to fb949e2676)

Solutions

  1. Set <workingDirectory> to an absolute Unix path, e.g. /workspace.
  2. Remove <workingDirectory> to let the image use its default WORKDIR.
  3. Verify any property/CLI value (-Djib.container.workingDirectory) also uses the leading slash.

Example fix

// before
<workingDirectory>workspace</workingDirectory>
// after
<workingDirectory>/workspace</workingDirectory>
Defensive patterns

Strategy: validation

Validate before calling

String wd = System.getProperty("jib.container.workingDirectory", pomWorkingDir);
if (wd != null && !wd.startsWith("/")) {
  throw new IllegalArgumentException("<workingDirectory> must be absolute Unix path, got: " + wd);
}

Try / catch

catch (MojoExecutionException e) { if (e.getMessage().contains("workingDirectory")) { /* set an absolute '/' path or remove the element */ } }

Prevention

When it happens

Trigger: Setting <workingDirectory> to a relative path like 'workspace' or a Windows path like 'C:\work' in pom.xml or via -Djib.container.workingDirectory.

Common situations: Windows developers specifying host-style paths; omitting the leading slash; empty string when a property interpolates to nothing.

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