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

  1. Provide at least one valid image tag in SimpleBuildOptions.Tags, e.g. []string{"myimage:latest"}
  2. Use a fully qualified, valid tag (name.NewTag must also parse it: name[:tag], optionally with registry)
  3. Default to a fallback tag like "slim-output:latest" when none is supplied
  4. 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

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


AI-assisted analysis of slimtoolkit/slim@81940d17fa (2026-08-31). Data as JSON: /api/errors/2a595d196587b650. Report an issue: GitHub.