slimtoolkit/slim · error
missing tags
Error message
missing tags
What it means
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.
Source
Thrown at pkg/imagebuilder/internalbuilder/engine.go:203
layer, err := layerFromDir(layerInfo)
if err != nil {
return nil, err
}
layersToAdd = append(layersToAdd, layer)
default:
return nil, fmt.Errorf("unknown image data source - %v", layerInfo.Source)
}
}
log.Debug("DefaultSimpleBuilder.Build: adding layers to image")
newImg, err := mutate.AppendLayers(img, layersToAdd...)
if err != nil {
return nil, err
}
if len(options.Tags) == 0 {
return nil, fmt.Errorf("missing tags")
}
tag, err := name.NewTag(options.Tags[0])
if err != nil {
return nil, err
}
otherTags := options.Tags[1:]
if ref.PushToDaemon {
log.Debug("DefaultSimpleBuilder.Build: saving image to Docker")
imageLoadResponseStr, err := daemon.Write(tag, newImg)
if err != nil {
return nil, err
}
log.Debugf("DefaultSimpleBuilder.Build: pushed image to daemon - %s", imageLoadResponseStr)
if ref.ShowBuildLogs {View on GitHub (pinned to 81940d17fa)
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)
Example fix
// before
opts := imagebuilder.SimpleBuildOptions{Layers: layers} // Tags missing
// after
opts := imagebuilder.SimpleBuildOptions{Layers: layers, Tags: []string{"myapp:latest"}} Defensive patterns
Strategy: validation
Validate before calling
if len(opts.Tags) == 0 || opts.Tags[0] == "" {
return fmt.Errorf("at least one image tag is required")
}
if _, err := name.NewTag(opts.Tags[0]); err != nil {
return fmt.Errorf("invalid tag %q: %w", opts.Tags[0], err)
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- empty image layer data source
- too many layers
- bad architecture value
- image layer data source path is not a tar file - %s
- unknown image data source - %v
AI-assisted analysis of slimtoolkit/slim@81940d17fa (2026-08-31).
Data as JSON: /api/errors/2a595d196587b650.
Report an issue: GitHub.