{"record":{"id":"2a595d196587b650","repo":"slimtoolkit/slim","slug":"missing-tags","errorCode":null,"errorMessage":"missing tags","messagePattern":"missing tags","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/imagebuilder/internalbuilder/engine.go","lineNumber":203,"sourceCode":"\t\t\tlayer, err := layerFromDir(layerInfo)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tlayersToAdd = append(layersToAdd, layer)\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unknown image data source - %v\", layerInfo.Source)\n\t\t}\n\t}\n\n\tlog.Debug(\"DefaultSimpleBuilder.Build: adding layers to image\")\n\tnewImg, err := mutate.AppendLayers(img, layersToAdd...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif len(options.Tags) == 0 {\n\t\treturn nil, fmt.Errorf(\"missing tags\")\n\t}\n\n\ttag, err := name.NewTag(options.Tags[0])\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\totherTags := options.Tags[1:]\n\n\tif ref.PushToDaemon {\n\t\tlog.Debug(\"DefaultSimpleBuilder.Build: saving image to Docker\")\n\t\timageLoadResponseStr, err := daemon.Write(tag, newImg)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tlog.Debugf(\"DefaultSimpleBuilder.Build: pushed image to daemon - %s\", imageLoadResponseStr)\n\t\tif ref.ShowBuildLogs {","sourceCodeStart":185,"sourceCodeEnd":221,"githubUrl":"https://github.com/slimtoolkit/slim/blob/81940d17fa112cc678e32209214bcb2355cb3004/pkg/imagebuilder/internalbuilder/engine.go#L185-L221","documentation":"After layers are assembled into the image, Build requires at least one tag in SimpleBuildOptions.Tags; the first tag (Tags[0]) names the produced image. An empty Tags slice means the resulting image has no name to load/push under, so the build fails with this error.","triggerScenarios":"Calling Engine.Build with SimpleBuildOptions.Tags nil or empty, e.g. forgetting to pass --tag on the CLI or leaving Tags unset when constructing options programmatically.","commonSituations":"CLI invocations omitting the tag flag; programmatic builds where Tags was added in a later version and older call sites don't set it; templated build scripts with an unset tag variable.","solutions":["Provide at least one valid image tag in SimpleBuildOptions.Tags, e.g. []string{\"myimage:latest\"}","Use a fully qualified, valid tag (name.NewTag must also parse it: name[:tag], optionally with registry)","Default to a fallback tag like \"slim-output:latest\" when none is supplied","Check that the tag variable isn't empty in scripts (validate before invoking)"],"exampleFix":"// before\nopts := imagebuilder.SimpleBuildOptions{Layers: layers} // Tags missing\n// after\nopts := imagebuilder.SimpleBuildOptions{Layers: layers, Tags: []string{\"myapp:latest\"}}","handlingStrategy":"validation","validationCode":"if len(opts.Tags) == 0 || opts.Tags[0] == \"\" {\n    return fmt.Errorf(\"at least one image tag is required\")\n}\nif _, err := name.NewTag(opts.Tags[0]); err != nil {\n    return fmt.Errorf(\"invalid tag %q: %w\", opts.Tags[0], err)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always supply Tags[0] with a name.NewTag-parseable value like \"repo:tag\"","Validate tags with go-containerregistry name.NewTag before calling Build","Add a default fallback tag in build scripts when the tag variable is empty"],"tags":["imagebuild","tags","validation","missing-field"],"backgroundTag":"missing-required-argument","analyzedSha":"81940d17fa112cc678e32209214bcb2355cb3004","analyzedAt":"2026-08-31T23:06:12.682Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}