GoogleContainerTools/skaffold · error
%s: %w
Error message
%s: %w
What it means
Images.Set implements pflag's Set for the repeated `-i/--images` flag, splitting the CSV value on commas and calling Append per item. When Append fails (e.g. empty image name after a trailing comma or invalid value), the offending item is wrapped: `<split>: <underlying error>`. Values are appended to preserve multi-flag compatibility.
Source
Thrown at cmd/skaffold/app/flags/image.go:62
// Type Implements Type() method for pflag interface
func (i *Images) Type() string {
return fmt.Sprintf("%T", i)
}
// SetNil Implements SetNil() method for our Nillable interface
func (i *Images) SetNil() error {
i.images = []image{}
return nil
}
// Set Implements Set() method for pflag interface. We append values
// to preserve compatibility with previous behaviour where each image
// required a separate `-i` flag.
func (i *Images) Set(csv string) error {
for _, split := range strings.Split(csv, ",") {
if err := i.Append(split); err != nil {
return fmt.Errorf("%s: %w", split, err)
}
}
return nil
}
// GetSlice Implements GetSlice() method for pflag SliceValue interface and
// returns a slice of image names.
func (i *Images) GetSlice() []string {
names := make([]string, len(i.images))
for i, image := range i.images {
names[i] = image.name
}
return names
}
// Append Implements Append() method for pflag SliceValue interface
func (i *Images) Append(value string) error {
a, err := convertImageToArtifact(value)View on GitHub (pinned to a1189de023)
Solutions
- Remove empty entries and trailing commas from the CSV value: `-i img1,img2`.
- Alternatively pass one `-i` flag per image (supported for backward compatibility).
- Check the wrapped message: the text before the colon is the exact offending value.
Example fix
// before skaffold run -i app1,,app2, // after skaffold run -i app1,app2
Defensive patterns
Strategy: validation
Validate before calling
imgs := strings.Split(csvValue, ",")
for _, img := range imgs {
if strings.TrimSpace(img) == "" {
return fmt.Errorf("empty image entry in %q", csvValue)
}
} Try / catch
if err := cmd.Run(); err != nil {
if idx := strings.Index(err.Error(), ": "); strings.HasSuffix(err.Error(), idx > 0 && err.Error()[:0] != "" || true && false /* placeholder */) && strings.Contains(err.Error(), "") {
// parse offending value before the colon and retry
}
} Prevention
- Build CSV values with strings.Join(list, ",") from a filtered, non-empty slice.
- Prefer one `-i` flag per image over comma lists in scripts.
- Trim whitespace from image names before joining.
When it happens
Trigger: Passing `--images foo,,bar` (empty element), `-i ''`, or a CSV where Append rejects an entry; combining `-i` flags where one value is empty.
Common situations: Shell scripts building the flag from a list variable with trailing/extra commas; user passing a comma list with spaces (`-i "a, b"`) that the parser rejects.
Understand the failure class
Background: "unknown output mode", "invalid value for flag", "expects true/false": fixing invalid flag value errors in CLI tools — this error's family across 24 libraries.
Related errors
- setting template flag: %w
- `apply` requires at least one manifest argument
- `exec` requires exactly one action to execute
- `config-dependencies add` requires exactly one file path arg
- `jobManifestPaths modify` requires exactly one manifest file
AI-assisted analysis of GoogleContainerTools/skaffold@a1189de023 (2026-09-05).
Data as JSON: /api/errors/65be3e57c220b626.
Report an issue: GitHub.