{"record":{"id":"f7f6449d42536582","repo":"GoogleContainerTools/jib","slug":"jib-plugin-version-is-s-but-is-required-to-be-s","errorCode":null,"errorMessage":"Jib plugin version is %s but is required to be %s","messagePattern":"Jib plugin version is (.+?) but is required to be (.+?)","errorType":"exception","errorClass":"GradleException","httpStatus":null,"severity":"error","filePath":"jib-gradle-plugin/src/main/java/com/google/cloud/tools/jib/gradle/JibPlugin.java","lineNumber":85,"sourceCode":"  }\n\n  /** Check the Jib version matches the required version (if specified). */\n  private static void checkJibVersion() {\n    // todo: should retrieve from project properties?\n    String requiredVersion = System.getProperty(REQUIRED_VERSION_PROPERTY_NAME);\n    if (requiredVersion == null) {\n      return;\n    }\n    String actualVersion = GradleProjectProperties.TOOL_VERSION;\n    if (actualVersion == null) {\n      throw new GradleException(\"Could not determine Jib plugin version\");\n    }\n    VersionChecker<GradleVersion> checker = new VersionChecker<>(GradleVersion::version);\n    if (!checker.compatibleVersion(requiredVersion, actualVersion)) {\n      String failure =\n          String.format(\n              \"Jib plugin version is %s but is required to be %s\", actualVersion, requiredVersion);\n      throw new GradleException(failure);\n    }\n  }\n\n  @Override\n  public void apply(Project project) {\n    checkGradleVersion();\n    checkJibVersion();\n\n    JibExtension jibExtension =\n        project.getExtensions().create(JIB_EXTENSION_NAME, JibExtension.class, project);\n\n    TaskContainer tasks = project.getTasks();\n    TaskProvider<BuildImageTask> buildImageTask =\n        tasks.register(\n            BUILD_IMAGE_TASK_NAME,\n            BuildImageTask.class,\n            task -> {\n              task.setGroup(\"Jib\");","sourceCodeStart":67,"sourceCodeEnd":103,"githubUrl":"https://github.com/GoogleContainerTools/jib/blob/fb949e2676afbbd7dd7a1ef61e20251931325654/jib-gradle-plugin/src/main/java/com/google/cloud/tools/jib/gradle/JibPlugin.java#L67-L103","documentation":"checkJibVersion compares the actual Jib plugin version against the required version given by the `jib.requiredVersion` system property. If VersionChecker says the installed plugin version is not compatible with the required one, apply() throws this GradleException with a formatted message naming both versions.","triggerScenarios":"Running a build (often via Skaffold) with -Djib.requiredVersion=X while the applied com.google.cloud.tools.jib plugin version differs from what X requires (checker.compatibleVersion returns false); e.g. requiredVersion=1.8.0 with Jib 3.x installed.","commonSituations":"Skaffold pinning an old jib.requiredVersion after the project upgraded the Jib plugin (or vice versa); CI configured with a stale jib.requiredVersion; multiple teams with mismatched plugin versions and a strict requiredVersion in CI scripts.","solutions":["Align the Jib plugin version in build.gradle/plugins block with the value expected by jib.requiredVersion","Update jib.requiredVersion (Skaffold config / gradle.properties / -D flag) to match the installed plugin version","Upgrade Skaffold so its injected jib.requiredVersion matches your plugin version","Remove jib.requiredVersion if the Skaffold compatibility pin is no longer needed"],"exampleFix":"// before\nplugins { id 'com.google.cloud.tools.jib' version '3.4.0' }\n// run with: -Djib.requiredVersion=1.8.0\n// after\nplugins { id 'com.google.cloud.tools.jib' version '1.8.0' } // matches jib.requiredVersion\n// or run without the stale pin: remove -Djib.requiredVersion=1.8.0","handlingStrategy":"validation","validationCode":"def required = System.getProperty('jib.requiredVersion')\ndef actual = GradleProjectProperties.TOOL_VERSION\nif (required && actual && !required.startsWith(actual.split('\\\\.').take(2).join('.'))) {\n  logger.warn(\"jib.requiredVersion=${required} may not match plugin ${actual}\")\n}","typeGuard":null,"tryCatchPattern":"try {\n  jib.build()\n} catch (GradleException e) {\n  if (e.message.startsWith('Jib plugin version is')) {\n    logger.error('Align plugin version with jib.requiredVersion: ' + e.message)\n  } else { throw e }\n}","preventionTips":["Keep jib.requiredVersion (if used) in gradle.properties next to the plugin version declaration","Update Skaffold and Jib plugin together","Remove stale -Djib.requiredVersion flags from CI scripts after plugin upgrades","Document the required version policy for the team"],"tags":["gradle","jib","version-mismatch","skaffold"],"backgroundTag":"version-mismatch","analyzedSha":"fb949e2676afbbd7dd7a1ef61e20251931325654","analyzedAt":"2026-09-06T14:04:09.491Z","contentChangedAt":"2026-09-06T14:04:09.491Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}