GoogleContainerTools/skaffold · error
unsupported prefix:
Error message
unsupported prefix:
What it means
The kubernetes log formatter's prefix function panics when deploy.logs.prefix in skaffold config holds a value outside the supported set (container, pod, podAndContainer, none, auto...). clusterPrefix delegates to prefix(), which expects the config to have been validated against the enum earlier.
Source
Thrown at pkg/skaffold/kubernetes/logger/formatter.go:127
}
}
if !present {
c = config.DefaultPipeline()
}
switch c.Deploy.Logs.Prefix {
case "auto":
if pod.Name != container.Name {
return podAndContainerPrefix(pod, container)
}
return autoPrefix(pod, container)
case "container":
return containerPrefix(container)
case "podAndContainer":
return podAndContainerPrefix(pod, container)
case "none":
return ""
default:
panic("unsupported prefix: " + c.Deploy.Logs.Prefix)
}
}
func autoPrefix(pod *v1.Pod, container v1.ContainerStatus) string {
if pod.Name != container.Name {
return fmt.Sprintf("[%s %s]", pod.Name, container.Name)
}
return fmt.Sprintf("[%s]", container.Name)
}
func containerPrefix(container v1.ContainerStatus) string {
return fmt.Sprintf("[%s]", container.Name)
}
func podAndContainerPrefix(pod *v1.Pod, container v1.ContainerStatus) string {
return fmt.Sprintf("[%s %s]", pod.Name, container.Name)
}
View on GitHub (pinned to a1189de023)
Solutions
- Fix deploy.logs.prefix in skaffold.yaml to one of: none, container, pod, podAndContainer (or omit it for auto)
- Run schema validation / `skaffold diagnose` to catch invalid enum values before deploy
- Upgrade or align skaffold version with the config's apiVersion if an enum value was renamed
Example fix
// before
deploy:
logs:
prefix: pods
// after
deploy:
logs:
prefix: pod Defensive patterns
Strategy: validation
Validate before calling
var validPrefixes = map[string]bool{"none": true, "container": true, "pod": true, "podAndContainer": true}
if p := cfg.Deploy.Logs.Prefix; p != "" && p != "auto" && !validPrefixes[p] {
return fmt.Errorf("invalid deploy.logs.prefix %q", p)
} Type guard
func isValidPrefix(p string) bool {
switch p {
case "", "auto", "none", "container", "pod", "podAndContainer":
return true
}
return false
} Try / catch
func safePrefix(c Config, pod *v1.Pod, ctr v1.ContainerStatus) (s string) {
defer func() { if recover() != nil { s = autoPrefix(pod, ctr) } }()
return clusterPrefix(c, pod, ctr)
} Prevention
- Omit deploy.logs.prefix unless you need a specific format; auto is the default
- Validate skaffold.yaml against the published JSON schema in CI
- Grep config for prefix values after upgrading skaffold versions
When it happens
Trigger: Setting deploy.logs.prefix to a misspelled or unsupported string in skaffold.yaml (e.g. 'pods', 'containerName') such that the default branch of the switch is reached at runtime.
Common situations: Typo in skaffold.yaml logs prefix; config edited by hand or by tooling that bypassed schema validation; older config file carried forward across a skaffold version that renamed an enum value.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- Unknown artifact
- bucket name is empty
- INSPECT_PROFILE_NOT_FOUND_ERR
- cannot resolve active Kubernetes context - multiple contexts
- CONFIG_BAD_FILTER_ERR
AI-assisted analysis of GoogleContainerTools/skaffold@a1189de023 (2026-09-05).
Data as JSON: /api/errors/a64ea406f357ba76.
Report an issue: GitHub.