slimtoolkit/slim · error
not enough image references
Error message
not enough image references
What it means
Final validation in CommandFlagValues: after checking flags and args, if either FirstImage or LastImage is still empty, the command fails with 'not enough image references'. This catches the case where neither (or only an incomplete set of) inputs was provided, or values were empty strings.
Source
Thrown at pkg/app/master/command/merge/cli.go:96
values.FirstImage = images[0]
values.LastImage = images[1]
}
if ctx.Args().Len() > 0 {
if ctx.Args().Len() < 2 {
xc.Out.Error("param.image", "must have two image references")
cli.ShowCommandHelp(ctx, Name)
return nil, fmt.Errorf("must have two image references")
}
values.FirstImage = ctx.Args().Get(0)
values.LastImage = ctx.Args().Get(1)
}
if values.FirstImage == "" || values.LastImage == "" {
xc.Out.Error("param.image", "not enough image references")
cli.ShowCommandHelp(ctx, Name)
return nil, fmt.Errorf("not enough image references")
}
return values, nil
}
View on GitHub (pinned to 81940d17fa)
Solutions
- Supply both image references explicitly: `slim merge image1 image2`.
- Verify shell variables are set before interpolation (`echo $IMG1 $IMG2`).
- Check the flag spelling; unknown/misspelled flags leave values empty.
- In CI, add a guard step that fails early if image variables are empty.
Example fix
// before
slim merge --image $IMG1 --image $IMG2 # IMG2 unset -> --image ''
// after
: "${IMG1:?unset}"; : "${IMG2:?unset}"
slim merge --image "$IMG1" --image "$IMG2" Defensive patterns
Strategy: validation
Validate before calling
: "${IMG1:?IMG1 unset}"; : "${IMG2:?IMG2 unset}"
[ -n "$IMG1" ] && [ -n "$IMG2" ] || { echo "both images required"; exit 2; } Try / catch
if err := runMerge(args); err != nil && strings.Contains(err.Error(), "not enough image references") {
// fail fast in CI with a clear message about missing image inputs
} Prevention
- Guard env-var interpolation with ${VAR:?} in CI
- Never pass --image '' — check variables before expansion
- Verify flag spellings so values actually populate
When it happens
Trigger: Running `slim merge` with no images at all, or with empty-string values (e.g., `--image ''` or a shell variable that expanded to nothing) so FirstImage/LastImage remain empty at merge/cli.go:96.
Common situations: Forgetting image arguments entirely; environment variables holding image names are unset (`--image $IMG1`); CI scripts with empty template variables; typos in flag names so values never get populated.
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/43c2f4a598d7b485.
Report an issue: GitHub.