{"record":{"id":"05504e4da3ff0581","repo":"GoogleContainerTools/jib","slug":"missing-option-name-must-be-specified-when-usin","errorCode":null,"errorMessage":"Missing option: --name must be specified when using --target=tar://....","messagePattern":"Missing option: --name must be specified when using --target=tar://\\.\\.\\.\\.","errorType":"console","errorClass":"CommandLine.ParameterException","httpStatus":null,"severity":"error","filePath":"jib-cli/src/main/java/com/google/cloud/tools/jib/cli/CommonCliOptions.java","lineNumber":424,"sourceCode":"  }\n\n  public List<String> getAdditionalTags() {\n    return additionalTags;\n  }\n\n  /**\n   * Returns the full path to the image metadata json file, if provided.\n   *\n   * @return optional value of path to image json file\n   */\n  public Optional<Path> getImageJsonPath() {\n    return Optional.ofNullable(imageJsonPath);\n  }\n\n  /** Validates parameters defined in this class that could not be done declaratively. */\n  public void validate() {\n    if (targetImage.startsWith(TAR_IMAGE_PREFIX) && name == null) {\n      throw new CommandLine.ParameterException(\n          spec.commandLine(),\n          \"Missing option: --name must be specified when using --target=tar://....\");\n    }\n  }\n}\n","sourceCodeStart":406,"sourceCodeEnd":430,"githubUrl":"https://github.com/GoogleContainerTools/jib/blob/fb949e2676afbbd7dd7a1ef61e20251931325654/jib-cli/src/main/java/com/google/cloud/tools/jib/cli/CommonCliOptions.java#L406-L430","documentation":"Jib CLI validates CommonCliOptions in validate(): building to a tar file via --target=tar://... requires the image's logical name, supplied through --name, because a tar archive has no registry to imply one. If the target starts with 'tar://' and --name is absent, a CommandLine.ParameterException is thrown before the build starts.","triggerScenarios":"Running jib build with --target=tar:///path/to/image.tar and no --name flag, or with --name omitted in a script/alias that only sets target.","commonSituations":"Scripting tar builds for offline distribution, migrating commands from registry-target builds to tar builds and forgetting the extra required flag.","solutions":["Add --name (e.g. --name=my-image:tag) alongside --target=tar://....","Update build scripts/aliases to include --name whenever the target is a tar path.","Use a registry or daemon target instead if a name is not meaningful for your workflow."],"exampleFix":"// before\njib build --target=tar://out/app.tar\n// after\njib build --target=tar://out/app.tar --name=my-app:1.0","handlingStrategy":"validation","validationCode":"if (target.startsWith(\"tar://\") && !args.contains(\"--name\")) {\n  throw new IllegalArgumentException(\"--name is required when --target=tar://...\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pair --target=tar://... with --name in scripts","Wrap jib invocations in a helper that enforces this combination","Lint build scripts for tar targets"],"tags":["cli","validation","tar"],"backgroundTag":"missing-required-flag","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"}