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 that <container><workingDirectory> is an absolute Unix-style path (must start with '/'). If the configured path is relative or otherwise non-absolute, InvalidWorkingDirectoryException is thrown while processing configuration and BuildDockerMojo.execute() converts it into a MojoExecutionException echoing the invalid value.

Source

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

    } 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\": "
              + ex.getInvalidFilesModificationTime(),
          ex);

    } catch (InvalidCreationTimeException ex) {
      throw new MojoExecutionException(
          "<container><creationTime> should be an ISO 8601 date-time (see "
              + "DateTimeFormatter.ISO_DATE_TIME) or a special keyword (\"EPOCH\", "
              + "\"USE_CURRENT_TIMESTAMP\"): "
              + ex.getInvalidCreationTime(),
          ex);

    } catch (JibPluginExtensionException ex) {

View on GitHub (pinned to fb949e2676)

Solutions

  1. Change <workingDirectory> to an absolute Unix path starting with '/', e.g. /app or /workspace.
  2. Replace any Windows-style path (drive letter, backslashes) with a forward-slash absolute path.
  3. If the intent was a relative offset, compute the absolute path in the pom (e.g. via properties) before passing it to Jib.

Example fix

// before (pom.xml)
<container><workingDirectory>app/bin</workingDirectory></container>
// after
<container><workingDirectory>/app/bin</workingDirectory></container>
Defensive patterns

Strategy: validation

Validate before calling

String wd = pomWorkingDirectory;
if (wd != null && !wd.startsWith("/")) {
  throw new IllegalArgumentException("<workingDirectory> must be an absolute Unix path: " + wd);
}

Type guard

boolean isAbsoluteUnixPath(String p) { return p != null && p.startsWith("/"); }

Prevention

When it happens

Trigger: Building with 'mvn jib:dockerBuild' when the pom contains <workingDirectory>app/bin</workingDirectory> (no leading slash) or a Windows-style path like 'C:\app' inside <container><workingDirectory>.

Common situations: Copying Docker WORKDIR conventions that allow relative paths; setting the directory on Windows and using a drive letter; typo omitting the leading slash; generating the value from a Maven property that resolves relative.

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