GoogleContainerTools/jib · error · GradleException

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

Error message

container.appRoot is not an absolute Unix-style path: ${invalidPathValue}

What it means

The Jib Gradle plugin validates that container.appRoot is an absolute Unix-style path (e.g. /app) because it is used as the destination directory for application files inside the image. InvalidAppRootException is thrown when the value is relative, Windows-style, or otherwise not an absolute Unix path, and the task rethrows it as this GradleException.

Source

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

      if (Strings.isNullOrEmpty(jibExtension.getTo().getImage())) {
        throw new GradleException(
            HelpfulSuggestions.forToNotConfigured(
                "Missing target image parameter",
                "'jib.to.image'",
                "build.gradle",
                "gradle jib --image <your image name>"));
      }

      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);

View on GitHub (pinned to fb949e2676)

Solutions

  1. Prefix the value with a forward slash, e.g. appRoot = '/app'.
  2. Remove any Windows-style path (drive letter, backslashes) and use a Unix path.
  3. If unsure, remove appRoot entirely to use Jib's default.

Example fix

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

Strategy: validation

Validate before calling

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

Try / catch

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

Prevention

When it happens

Trigger: Setting jib.container.appRoot to a relative path like 'app' or 'C:\\app' (or a Windows drive path) and running any jib build task.

Common situations: Developers on Windows copying example config with backslashes; forgetting the leading slash ('app' instead of '/app'); migrating from another plugin where appRoot was relative; setting appRoot for WAR-style layouts to a path with a trailing filename expectation.

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