slimtoolkit/slim · error
malformed Kubernetes workload name
Error message
malformed Kubernetes workload name
What it means
KubernetesTarget.WorkloadName() parses the Workload field as a "<kind>/<name>" string (e.g. "deployment/my-app") and returns this ad-hoc error when the string does not split into exactly two non-empty parts — i.e. the name portion is missing or the value contains extra slashes.
Source
Thrown at pkg/app/master/config/config.go:289
type KubernetesOptions struct {
Target KubernetesTarget
TargetOverride KubernetesTargetOverride
Manifests []string
Kubeconfig string
}
type KubernetesTarget struct {
Workload string
Namespace string
Container string
}
func (t *KubernetesTarget) WorkloadName() (string, error) {
parts := strings.Split(t.Workload, "/")
if len(parts) != 2 || len(parts[1]) == 0 {
return "", errors.New("malformed Kubernetes workload name")
}
return parts[1], nil
}
type KubernetesTargetOverride struct {
Image string
}
func (ko KubernetesOptions) HasTargetSet() bool {
return ko.Target.Workload != ""
}
View on GitHub (pinned to 81940d17fa)
Solutions
- Format the target as "<kind>/<name>", e.g. "deployment/my-app" or "pod/my-pod"
- Move the namespace out of the workload string into the namespace/target field
- Trim stray slashes and re-check the value passed to the --target flag or config
Example fix
// before
KubernetesTarget{Workload: "my-app"}
// after
KubernetesTarget{Workload: "deployment/my-app"} Defensive patterns
Strategy: validation
Validate before calling
func validWorkload(w string) bool {
parts := strings.Split(w, "/")
return len(parts) == 2 && len(parts[1]) > 0
} Try / catch
// Go
if name, err := target.WorkloadName(); err != nil {
// reject config early: workload must be "kind/name"
} Prevention
- Always pass the target as "<kind>/<name>"
- Keep namespace in its own field, never in the workload string
- Trim slashes and validate target input in config loading
When it happens
Trigger: Setting the k8s target workload to a bare name without a kind prefix ("my-app"), an empty name ("deployment/"), or a value with more than one slash ("deploy/ns/my-app").
Common situations: Users pasting just the pod/deployment name from kubectl output; including a namespace in the workload value instead of using the namespace field; copy-paste with trailing slashes.
Understand the failure class
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
Related errors
AI-assisted analysis of slimtoolkit/slim@81940d17fa (2026-08-31).
Data as JSON: /api/errors/4e02c1aacfc34798.
Report an issue: GitHub.