GoogleContainerTools/jib · error · GradleException

Missing target image parameter, perhaps you should add a 'ji

Error message

Missing target image parameter, perhaps you should add a 'jib.to.image' configuration parameter to your build.gradle or set the parameter via the commandline (e.g. 'gradle jib --image <your image name>').

What it means

Jib requires a target image reference to know where to tag/push the built image. This error is thrown by the jibBuild-style task when jib.to.image is null or empty. HelpfulSuggestions adds hints to configure 'jib.to.image' in build.gradle or pass --image on the command line.

Source

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

      throws IOException, BuildStepsExecutionException, CacheDirectoryCreationException,
          MainClassInferenceException, InvalidGlobalConfigException {
    // Asserts required @Input parameters are not null.
    Preconditions.checkNotNull(jibExtension);
    TaskCommon.disableHttpLogging();
    TempDirectoryProvider tempDirectoryProvider = new TempDirectoryProvider();

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

View on GitHub (pinned to fb949e2676)

Solutions

  1. Set the target image in build.gradle: jib { to { image = 'registry/myapp:tag' } }.
  2. Pass it on the command line: gradle jib --image=registry/myapp:tag.
  3. Check the property name is exactly to.image under the jib extension.
  4. In multi-module builds, configure to.image in each module that has its own jib task.

Example fix

// before
jib {
  from { image = 'eclipse-temurin:17' }
}
// after
jib {
  from { image = 'eclipse-temurin:17' }
  to { image = 'gcr.io/my-project/my-app:1.0.0' }
}
Defensive patterns

Strategy: validation

Validate before calling

if (!project.hasProperty('jib.to.image') && (jib.to.image == null || jib.to.image.empty)) {
  throw new GradleException("Set jib.to.image before running jib")
}

Try / catch

try {
  tasks.named('jib').get().execute()
} catch (GradleException e) {
  if (e.message?.startsWith('Missing target image parameter')) {
    logger.error('Pass --image=registry/app:tag or set jib { to { image = ... } }')
  }
  throw e
}

Prevention

When it happens

Trigger: Running 'gradle jib' (or a task extending BuildImageTask) when neither jib.to.image is set in the build configuration nor the -Dimage/--image parameter is supplied.

Common situations: New projects where only the base image was configured; renaming the extension property (to.image moved under jib.to); running jib locally expecting the image parameter from CI config that isn't present; typo like jib.to.name instead of jib.to.image.

Understand the failure class

Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.

Related errors


AI-assisted analysis of GoogleContainerTools/jib@fb949e2676 (2026-09-06). Data as JSON: /api/errors/c5bfe24b5be93f9b. Report an issue: GitHub.