{"record":{"id":"a64ea406f357ba76","repo":"GoogleContainerTools/skaffold","slug":"unsupported-prefix","errorCode":null,"errorMessage":"unsupported prefix: ","messagePattern":"unsupported prefix: ","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/skaffold/kubernetes/logger/formatter.go","lineNumber":127,"sourceCode":"\t\t}\n\t}\n\tif !present {\n\t\tc = config.DefaultPipeline()\n\t}\n\tswitch c.Deploy.Logs.Prefix {\n\tcase \"auto\":\n\t\tif pod.Name != container.Name {\n\t\t\treturn podAndContainerPrefix(pod, container)\n\t\t}\n\t\treturn autoPrefix(pod, container)\n\tcase \"container\":\n\t\treturn containerPrefix(container)\n\tcase \"podAndContainer\":\n\t\treturn podAndContainerPrefix(pod, container)\n\tcase \"none\":\n\t\treturn \"\"\n\tdefault:\n\t\tpanic(\"unsupported prefix: \" + c.Deploy.Logs.Prefix)\n\t}\n}\n\nfunc autoPrefix(pod *v1.Pod, container v1.ContainerStatus) string {\n\tif pod.Name != container.Name {\n\t\treturn fmt.Sprintf(\"[%s %s]\", pod.Name, container.Name)\n\t}\n\treturn fmt.Sprintf(\"[%s]\", container.Name)\n}\n\nfunc containerPrefix(container v1.ContainerStatus) string {\n\treturn fmt.Sprintf(\"[%s]\", container.Name)\n}\n\nfunc podAndContainerPrefix(pod *v1.Pod, container v1.ContainerStatus) string {\n\treturn fmt.Sprintf(\"[%s %s]\", pod.Name, container.Name)\n}\n","sourceCodeStart":109,"sourceCodeEnd":145,"githubUrl":"https://github.com/GoogleContainerTools/skaffold/blob/a1189de023efc32d4b8e11f395acc678aa555011/pkg/skaffold/kubernetes/logger/formatter.go#L109-L145","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\ndeploy:\n  logs:\n    prefix: pods\n// after\ndeploy:\n  logs:\n    prefix: pod","handlingStrategy":"validation","validationCode":"var validPrefixes = map[string]bool{\"none\": true, \"container\": true, \"pod\": true, \"podAndContainer\": true}\nif p := cfg.Deploy.Logs.Prefix; p != \"\" && p != \"auto\" && !validPrefixes[p] {\n  return fmt.Errorf(\"invalid deploy.logs.prefix %q\", p)\n}","typeGuard":"func isValidPrefix(p string) bool {\n  switch p {\n  case \"\", \"auto\", \"none\", \"container\", \"pod\", \"podAndContainer\":\n    return true\n  }\n  return false\n}","tryCatchPattern":"func safePrefix(c Config, pod *v1.Pod, ctr v1.ContainerStatus) (s string) {\n  defer func() { if recover() != nil { s = autoPrefix(pod, ctr) } }()\n  return clusterPrefix(c, pod, ctr)\n}","preventionTips":["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"],"tags":["config","logging","enum","panic"],"backgroundTag":"invalid-enum-value","analyzedSha":"a1189de023efc32d4b8e11f395acc678aa555011","analyzedAt":"2026-09-05T12:09:27.064Z","contentChangedAt":"2026-09-05T12:09:27.064Z","schemaVersion":2},"datasetVersion":"2026-09-12T17:17:11.597Z"}