{"record":{"id":"15721fc94f008b5b","repo":"lima-vm/lima","slug":"field-s-guestipmustbezero-can-only-be-true-when","errorCode":null,"errorMessage":"field `%s.guestIPMustBeZero` can only be true when field `%s.guestIP` is 0.0.0.0","messagePattern":"field `(.+?)\\.guestIPMustBeZero` can only be true when field `(.+?)\\.guestIP` is 0\\.0\\.0\\.0","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/limayaml/validate.go","lineNumber":310,"sourceCode":"\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}\n\t\t}\n\t\tif rule.HostPort != 0 {\n\t\t\tif rule.HostSocket != \"\" {\n\t\t\t\terrs = errors.Join(errs, fmt.Errorf(\"field `%s.hostPort` must be 0 when field `%s.hostSocket` is set\", field, field))\n\t\t\t}\n\t\t\tif rule.HostPort != rule.HostPortRange[0] {","sourceCodeStart":292,"sourceCodeEnd":328,"githubUrl":"https://github.com/lima-vm/lima/blob/dd909d0973cd84fa35f9e1693181b4585ea616c1/pkg/limayaml/validate.go#L292-L328","documentation":"The port forwarding rule sets guestIPMustBeZero=true, which forces the guest to bind 0.0.0.0, but guestIP is set to something other than 0.0.0.0 — the two settings contradict each other.","triggerScenarios":"Calling limactl validate/start/etc. with a portForwards rule that sets both `guestSocket: /path/to.sock` and a non-zero `guestPort`.","commonSituations":"Copy-pasting an existing TCP rule and adding guestSocket without removing guestPort; converting a TCP forward to a socket forward incrementally; defaults that left guestPort populated before socket was added.","solutions":["Delete the `guestPort` field from the rule that sets `guestSocket`","Ensure the guest port is 0 (explicit `guestPort: 0`) if the schema requires the key","If both destinations are needed, create two separate portForward rules"],"exampleFix":"// before\nportForwards:\n- guestSocket: /run/docker.sock\n  guestPort: 2375\n  hostSocket: docker.sock\n// after\nportForwards:\n- guestSocket: /run/docker.sock\n  hostSocket: docker.sock","handlingStrategy":"validation","validationCode":"for i, r := range cfg.PortForwards {\n    if r.GuestSocket != \"\" && r.GuestPort != 0 {\n        return fmt.Errorf(\"portForwards[%d]: guestPort must be 0 when guestSocket is set\", i)\n    }\n}","typeGuard":"func socketForwardIsClean(r limatype.PortForward) bool {\n    return r.GuestSocket == \"\" || r.GuestPort == 0\n}","tryCatchPattern":null,"preventionTips":["When converting TCP forwards to socket forwards, delete guestPort/hostPort keys, don't just add socket keys","Keep one rule per destination; combine nothing","Validate after every YAML edit with limactl validate"],"tags":["config-validation","port-forward","lima-yaml"],"backgroundTag":"mutually-exclusive-fields","analyzedSha":"dd909d0973cd84fa35f9e1693181b4585ea616c1","analyzedAt":"2026-09-01T14:24:59.842Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}