{"record":{"id":"e453f3dc6d6132bd","repo":"lima-vm/lima","slug":"field-probe-d-mode-can-only-be-q","errorCode":null,"errorMessage":"field `probe[%d].mode` can only be %#q","messagePattern":"field `probe\\[(.+?)\\]\\.mode` can only be %#q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/limayaml/validate.go","lineNumber":304,"sourceCode":"\t\t\t}\n\t\t}\n\t}\n\tfor i, p := range y.Probes {\n\t\tif p.File != nil {\n\t\t\tif p.File.URL != \"\" {\n\t\t\t\terrs = errors.Join(errs, fmt.Errorf(\"field `probe[%d].file.url` must be empty during validation (script should already be embedded)\", i))\n\t\t\t}\n\t\t\tif p.File.Digest != nil {\n\t\t\t\terrs = errors.Join(errs, fmt.Errorf(\"field `probe[%d].file.digest` support is not yet implemented\", i))\n\t\t\t}\n\t\t}\n\t\tif p.Script != nil && !strings.HasPrefix(*p.Script, \"#!\") {\n\t\t\terrs = errors.Join(errs, fmt.Errorf(\"field `probe[%d].script` must start with a '#!' line\", i))\n\t\t}\n\t\tswitch p.Mode {\n\t\tcase limatype.ProbeModeReadiness:\n\t\tdefault:\n\t\t\terrs = errors.Join(errs, fmt.Errorf(\"field `probe[%d].mode` can only be %#q\", i, limatype.ProbeModeReadiness))\n\t\t}\n\t}\n\tfor i, rule := range y.PortForwards {\n\t\tfield := fmt.Sprintf(\"portForwards[%d]\", i)\n\t\tif *rule.GuestIPMustBeZero && !rule.GuestIP.Equal(net.IPv4zero) {\n\t\t\terrs = errors.Join(errs, fmt.Errorf(\"field `%s.guestIPMustBeZero` can only be true when field `%s.guestIP` is 0.0.0.0\", field, field))\n\t\t}\n\t\tif rule.GuestPort != 0 {\n\t\t\tif rule.GuestSocket != \"\" {\n\t\t\t\terrs = errors.Join(errs, fmt.Errorf(\"field `%s.guestPort` must be 0 when field `%s.guestSocket` is set\", field, field))\n\t\t\t}\n\t\t\tif rule.GuestPort != rule.GuestPortRange[0] {\n\t\t\t\terrs = errors.Join(errs, fmt.Errorf(\"field `%s.guestPort` must match field `%s.guestPortRange[0]`\", field, field))\n\t\t\t}\n\t\t\t// redundant validation to make sure the error contains the correct field name\n\t\t\tif err := validatePort(field+\".guestPort\", rule.GuestPort); err != nil {\n\t\t\t\terrs = errors.Join(errs, err)\n\t\t\t}","sourceCodeStart":286,"sourceCodeEnd":322,"githubUrl":"https://github.com/lima-vm/lima/blob/dd909d0973cd84fa35f9e1693181b4585ea616c1/pkg/limayaml/validate.go#L286-L322","documentation":"`guestIPMustBeZero` is a marker meaning 'the guest IP must be 0.0.0.0 (any interface)'. Validate() enforces consistency: it can only be true when the rule's guestIP actually equals 0.0.0.0. Note this check runs on the post-default config where guestIP must have been explicitly set to 0.0.0.0 for this combination to be legal.","triggerScenarios":"Calling limactl validate/start/etc. with a portForward rule where `guestIPMustBeZero: true` (either hand-written or set programmatically) while `guestIP` is a concrete address such as 127.0.0.1 or 192.168.5.15.","commonSituations":"Setting guestIP to a specific IP and separately toggling guestIPMustBeZero without understanding it is derived; templates or tools that set the flag but leave a stale guestIP; after editing rules from another rule that had 0.0.0.0.","solutions":["Remove `guestIPMustBeZero: true`, or set it to false, when guestIP is a specific address","Set `guestIP: 0.0.0.0` if binding all guest interfaces is intended","Rely on limayaml defaulting (guestIPMustBeZero is normally computed, not hand-set) and only override guestIP"],"exampleFix":"// before\nportForwards:\n- guestIP: 127.0.0.1\n  guestIPMustBeZero: true\n  guestPort: 8080\n  hostPort: 8080\n// after\nportForwards:\n- guestIP: 127.0.0.1\n  guestPort: 8080\n  hostPort: 8080","handlingStrategy":"validation","validationCode":"for i, r := range cfg.PortForwards {\n    if r.GuestIPMustBeZero && !r.GuestIP.Equal(net.IPv4zero) {\n        return fmt.Errorf(\"portForwards[%d]: guestIPMustBeZero requires guestIP 0.0.0.0\", i)\n    }\n}","typeGuard":"func guestIPMustBeZeroConsistent(r limatype.PortForward) bool {\n    return !r.GuestIPMustBeZero || r.GuestIP.Equal(net.IPv4zero)\n}","tryCatchPattern":null,"preventionTips":["Treat guestIPMustBeZero as a derived/internal flag, not a user setting","Only set guestIP in lima.yaml; let defaults compute the flag","Review port forward blocks after copying rules between configs"],"tags":["config-validation","port-forward","network"],"backgroundTag":"mutually-exclusive-fields","analyzedSha":"dd909d0973cd84fa35f9e1693181b4585ea616c1","analyzedAt":"2026-09-01T14:24:59.842Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}