{"record":{"id":"793c7835ac0e94fc","repo":"GoogleContainerTools/skaffold","slug":"port-forward-q-cannot-be-combined-with-other-opti","errorCode":null,"errorMessage":"port-forward %q cannot be combined with other options","messagePattern":"port-forward %q cannot be combined with other options","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/skaffold/config/portforward.go","lineNumber":172,"sourceCode":"\t\t}\n\t\tb, err := strconv.ParseBool(o)\n\t\tif err == nil && !b {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}\n\n// validateModes checks that the given set of port-forward modes are ok.\n// For example, `off` and boolean values should not be combined with other values.\nfunc validateModes(modes []string) error {\n\tfor _, mode := range modes {\n\t\tif err := validateMode(mode); err != nil {\n\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 {","sourceCodeStart":154,"sourceCodeEnd":190,"githubUrl":"https://github.com/GoogleContainerTools/skaffold/blob/a1189de023efc32d4b8e11f395acc678aa555011/pkg/skaffold/config/portforward.go#L154-L190","documentation":"skaffold's --port-forward option accepts multiple named modes (user, services, pods, debug), but boolean values (true/false/1/0) and the legacy value `off` are only meaningful when used alone. validateModes throws this error when such a value appears together with other modes, because the combination is ambiguous (e.g. 'pods,off' cannot express a consistent intent).","triggerScenarios":"Calling Append/Replace/Set on PortForwardOptions with a mode list of length > 1 containing a strconv.ParseBool-parseable value (true/false/1/0/t/f) or the literal `off`, e.g. `--port-forward=pods,true` or `--port-forward=off,user`.","commonSituations":"Users upgrading from older skaffold where --port-forward was purely boolean keep an old `--port-forward=true` alongside newly added named modes in scripts, shell aliases, or skaffold.yaml profiles; CI pipelines concatenating flags produce `--port-forward=user,off`.","solutions":["Remove the boolean/`off` value and keep only named modes, e.g. `--port-forward=user,services`","If forwarding should be disabled, use `--port-forward=off` alone (or omit the flag)","Update stale scripts/aliases written for the boolean-era flag syntax"],"exampleFix":"// before\n--port-forward=pods,true\n// after\n--port-forward=pods","handlingStrategy":"validation","validationCode":"func validPortForwardFlag(v string) error {\n  modes := strings.Split(v, \",\")\n  boolish := func(m string) bool { _, err := strconv.ParseBool(m); return err == nil || m == \"off\" }\n  if len(modes) > 1 {\n    for _, m := range modes {\n      if boolish(m) {\n        return fmt.Errorf(\"port-forward %q cannot be combined with other options\", m)\n      }\n    }\n  }\n  return nil\n}","typeGuard":"func isBooleanOrOff(m string) bool {\n  if m == \"off\" { return true }\n  _, err := strconv.ParseBool(m)\n  return err == nil\n}","tryCatchPattern":"if err := opts.Append(flagValue); err != nil {\n  if strings.Contains(err.Error(), \"cannot be combined\") {\n    log.Warn(\"boolean/off must be used alone; using default named modes\")\n    err = opts.Replace(\"user\")\n  }\n  return err\n}","preventionTips":["Never mix true/false/1/0/off with named modes in --port-forward","Migrate old boolean-era flags to named modes (user,services,pods,debug)","Add CI validation of skaffold flags before deploy"],"tags":["cli","config-validation","port-forward"],"backgroundTag":"conflicting-flag-options","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"}