{"record":{"id":"f5aaccc95dc486cf","repo":"lima-vm/lima","slug":"field-probe-d-script-must-start-with-a-li","errorCode":null,"errorMessage":"field `probe[%d].script` must start with a '#!' line","messagePattern":"field `probe\\[(.+?)\\]\\.script` must start with a '#!' line","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/limayaml/validate.go","lineNumber":299,"sourceCode":"\t\t}\n\t\tfor i, f := range y.Containerd.Archives {\n\t\t\terr := validateFileObject(f, fmt.Sprintf(\"containerd.archives[%d]\", i))\n\t\t\tif err != nil {\n\t\t\t\terrs = errors.Join(errs, err)\n\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))","sourceCodeStart":281,"sourceCodeEnd":317,"githubUrl":"https://github.com/lima-vm/lima/blob/dd909d0973cd84fa35f9e1693181b4585ea616c1/pkg/limayaml/validate.go#L281-L317","documentation":"Every probe script must be an executable script beginning with a shebang (`#!`) line, because it is written to a file and executed inside the guest. Validate() rejects probe.script values that do not start with `#!`.","triggerScenarios":"Calling limactl validate/start/etc. with a probe whose `script:` begins with blank lines, comments, or commands instead of `#!` on the first line.","commonSituations":"Writing `script: |` blocks starting with shell commands (`curl ...`) forgetting the shebang; leading empty line introduced by YAML block scalar formatting (`|` vs `|-` and indentation).","solutions":["Add a shebang line as the very first line, e.g. `#!/bin/sh`","Remove leading blank lines in the script block (use `|-` if trailing newline matters)","If only a probe name/command is intended, check probe.mode/hint fields instead of a script"],"exampleFix":"// before\nprobes:\n- script: |\n    systemctl is-active docker\n// after\nprobes:\n- script: |\n    #!/bin/sh\n    systemctl is-active docker","handlingStrategy":"validation","validationCode":"for i, p := range cfg.Probes {\n    if p.Script != nil && !strings.HasPrefix(*p.Script, \"#!\") {\n        return fmt.Errorf(\"probe[%d].script must start with '#!'\", i)\n    }\n}","typeGuard":"func probeScriptIsExecutable(p limatype.Probe) bool {\n    return p.Script != nil && strings.HasPrefix(*p.Script, \"#!\")\n}","tryCatchPattern":null,"preventionTips":["Always begin probe scripts with #!/bin/sh or #!/bin/bash","Use YAML `|-` blocks and check the first rendered line has no leading blank","Lint lima.yaml so probe scripts are checked before limactl start"],"tags":["config-validation","probe","shebang","shell"],"backgroundTag":"schema-validation-failed","analyzedSha":"dd909d0973cd84fa35f9e1693181b4585ea616c1","analyzedAt":"2026-09-01T14:24:59.842Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}