{"record":{"id":"4e02c1aacfc34798","repo":"slimtoolkit/slim","slug":"malformed-kubernetes-workload-name","errorCode":null,"errorMessage":"malformed Kubernetes workload name","messagePattern":"malformed Kubernetes workload name","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/app/master/config/config.go","lineNumber":289,"sourceCode":"\ntype KubernetesOptions struct {\n\tTarget         KubernetesTarget\n\tTargetOverride KubernetesTargetOverride\n\n\tManifests  []string\n\tKubeconfig string\n}\n\ntype KubernetesTarget struct {\n\tWorkload  string\n\tNamespace string\n\tContainer string\n}\n\nfunc (t *KubernetesTarget) WorkloadName() (string, error) {\n\tparts := strings.Split(t.Workload, \"/\")\n\tif len(parts) != 2 || len(parts[1]) == 0 {\n\t\treturn \"\", errors.New(\"malformed Kubernetes workload name\")\n\t}\n\n\treturn parts[1], nil\n}\n\ntype KubernetesTargetOverride struct {\n\tImage string\n}\n\nfunc (ko KubernetesOptions) HasTargetSet() bool {\n\treturn ko.Target.Workload != \"\"\n}\n","sourceCodeStart":271,"sourceCodeEnd":302,"githubUrl":"https://github.com/slimtoolkit/slim/blob/81940d17fa112cc678e32209214bcb2355cb3004/pkg/app/master/config/config.go#L271-L302","documentation":"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.","triggerScenarios":"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\").","commonSituations":"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.","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"],"exampleFix":"// before\nKubernetesTarget{Workload: \"my-app\"}\n// after\nKubernetesTarget{Workload: \"deployment/my-app\"}","handlingStrategy":"validation","validationCode":"func validWorkload(w string) bool {\n\tparts := strings.Split(w, \"/\")\n\treturn len(parts) == 2 && len(parts[1]) > 0\n}","typeGuard":null,"tryCatchPattern":"// Go\nif name, err := target.WorkloadName(); err != nil {\n\t// reject config early: workload must be \"kind/name\"\n}","preventionTips":["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"],"tags":["kubernetes","configuration","parsing"],"backgroundTag":"malformed-workload-name","analyzedSha":"81940d17fa112cc678e32209214bcb2355cb3004","analyzedAt":"2026-08-31T23:06:12.682Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}