GoogleContainerTools/jib · error · GradleException

container.appRoot is not an absolute Unix-style path: ${ex.g

Error message

container.appRoot is not an absolute Unix-style path: ${ex.getInvalidPathValue()}

What it means

Jib validates that container.appRoot is an absolute Unix-style path (e.g. /app) when building the image tarball via gradle jibBuildTar. InvalidAppRootException is thrown for relative paths, Windows-style paths, or values without a leading slash, wrapped into this GradleException with the offending value.

Source

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

        GradleProjectProperties.getForProject(
            getProject(),
            getLogger(),
            tempDirectoryProvider,
            jibExtension.getConfigurationName().get());
    GlobalConfig globalConfig = GlobalConfig.readConfig();
    Future<Optional<String>> updateCheckFuture =
        TaskCommon.newUpdateChecker(projectProperties, globalConfig, getLogger());
    try {
      PluginConfigurationProcessor.createJibBuildRunnerForTarImage(
              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);

View on GitHub (pinned to fb949e2676)

Solutions

  1. Prefix the value with '/' so it is an absolute Unix path, e.g. jib { container { appRoot = '/app' } }
  2. Remove any Windows drive letters or backslashes; use forward slashes only
  3. If you didn't intend to set appRoot, delete the container.appRoot line to use the default /app

Example fix

// before
jib { container { appRoot = 'myapp' } }
// after
jib { container { appRoot = '/myapp' } }
Defensive patterns

Strategy: validation

Validate before calling

def appRoot = project.jib.container.appRoot.getOrElse('/app')
if (!(appRoot ==~ /^\/[^\0]+/)) throw new GradleException("container.appRoot must be absolute Unix path: $appRoot")

Prevention

When it happens

Trigger: Running gradle jibBuildTar with jib { container { appRoot = 'app' } } (no leading slash), a Windows path like 'C:\app', or otherwise non-Unix absolute path.

Common situations: Setting appRoot to a relative directory for convenience; porting a Windows developer's config; confusing appRoot with a classpath-relative path; trailing typo dropping the leading '/' while fixing other config.

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