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

BuildTarMojo.execute throws this when <container><workingDirectory> is not an absolute Unix-style path. InvalidWorkingDirectoryException supplies the invalid value, embedded in the message. The working directory must start with '/' and use Unix path syntax.

Source

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

              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. Make the path absolute with a leading slash, e.g. /workspace.
  2. Replace backslashes with forward slashes and remove drive letters.
  3. Remove <workingDirectory> if the image default is acceptable.

Example fix

<!-- before -->
<container><workingDirectory>workspace/app</workingDirectory></container>
<!-- after -->
<container><workingDirectory>/workspace/app</workingDirectory></container>
Defensive patterns

Strategy: validation

Validate before calling

String workDir = "workspace/app";
if (!workDir.startsWith("/") || workDir.contains("\\")) {
  throw new IllegalArgumentException("<workingDirectory> must be absolute Unix path: " + workDir);
}

Try / catch

try { ... } catch (MojoExecutionException e) { if (e.getMessage().startsWith("<container><workingDirectory>")) { /* add leading slash */ } throw e; }

Prevention

When it happens

Trigger: Running 'mvn jib:buildTar' with <container><workingDirectory> set to 'home/user/app' (no leading slash) or 'C:\app'.

Common situations: Copying Dockerfile WORKDIR conventions incorrectly; Windows backslash paths pasted into the pom; forgetting 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/00286660f2e15e4c. Report an issue: GitHub.