{"record":{"id":"040d27e165a48b14","repo":"GoogleContainerTools/skaffold","slug":"unknown-port-forward-option-q-expected-user-se","errorCode":null,"errorMessage":"unknown port-forward option %q: expected: user, services, pods, debug, off","messagePattern":"unknown port-forward option %q: expected: user, services, pods, debug, off","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/skaffold/config/portforward.go","lineNumber":186,"sourceCode":"\t\t\treturn err\n\t\t}\n\t\t// Boolean values (true/false/1/0) and `off` must be used alone.\n\t\tif _, err := strconv.ParseBool(mode); len(modes) > 1 && (err == nil || mode == off) {\n\t\t\treturn fmt.Errorf(\"port-forward %q cannot be combined with other options\", mode)\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc validateMode(mode string) error {\n\tif _, err := strconv.ParseBool(mode); err == nil {\n\t\treturn nil\n\t}\n\tswitch mode {\n\tcase off, user, services, pods, debug:\n\t\treturn nil\n\tdefault:\n\t\treturn fmt.Errorf(\"unknown port-forward option %q: expected: user, services, pods, debug, off\", mode)\n\t}\n}\n\nfunc (p PortForwardOptions) ForwardUser(runMode RunMode) bool {\n\t// When --port-forward was a boolean option, user-defined port-forwards\n\t// were enabled all modes.\n\treturn p.forwardUser || p.compat\n}\n\nfunc (p PortForwardOptions) ForwardServices(runMode RunMode) bool {\n\t// When --port-forward was a boolean option, service forwarding\n\t// was enabled all modes.\n\treturn p.forwardServices || p.compat\n}\n\nfunc (p PortForwardOptions) ForwardPods(runMode RunMode) bool {\n\t// Compatibility break: when `--port-forward` was a boolean option,\n\t// all pods containerPorts were forwarded for `debug`.  But now we","sourceCodeStart":168,"sourceCodeEnd":204,"githubUrl":"https://github.com/GoogleContainerTools/skaffold/blob/a1189de023efc32d4b8e11f395acc678aa555011/pkg/skaffold/config/portforward.go#L168-L204","documentation":"validateMode rejects any --port-forward value that is neither a boolean literal nor one of the recognized named modes (off, user, services, pods, debug). The library throws this so typos in mode names fail fast instead of silently not forwarding.","triggerScenarios":"Calling Append/Replace (via validateModes) with a mode string that fails strconv.ParseBool and is not exactly one of off/user/services/pods/debug, e.g. `--port-forward=pod`, `--port-forward=Users`, `--port-forward=service`.","commonSituations":"Typos or pluralization mistakes in the flag value; copying flags from old docs or blog posts that predate the named-mode syntax; case sensitivity surprises (`Pods` vs `pods`).","solutions":["Use an exact valid mode: user, services, pods, debug, or off","Fix casing — values are lowercase and case-sensitive","Check `skaffold help` or docs for the current --port-forward syntax"],"exampleFix":"// before\n--port-forward=pod\n// after\n--port-forward=pods","handlingStrategy":"validation","validationCode":"var validModes = map[string]bool{\"off\":true,\"user\":true,\"services\":true,\"pods\":true,\"debug\":true}\nfunc checkModes(v string) error {\n  for _, m := range strings.Split(v, \",\") {\n    if _, err := strconv.ParseBool(m); err == nil || validModes[m] { continue }\n    return fmt.Errorf(\"invalid port-forward mode %q\", m)\n  }\n  return nil\n}","typeGuard":"func isKnownPortForwardMode(m string) bool {\n  switch m {\n  case \"off\", \"user\", \"services\", \"pods\", \"debug\":\n    return true\n  }\n  _, err := strconv.ParseBool(m)\n  return err == nil\n}","tryCatchPattern":"if err := opts.Append(mode); err != nil {\n  if strings.Contains(err.Error(), \"unknown port-forward option\") {\n    return fmt.Errorf(\"%w; valid modes: user, services, pods, debug, off\", err)\n  }\n  return err\n}","preventionTips":["Only use exact lowercase mode names: user, services, pods, debug, off","Quote flag values in shell to avoid case/format surprises","Pin and read the skaffold docs matching your installed version"],"tags":["cli","config-validation","port-forward"],"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"}