{"record":{"id":"11779a89691795aa","repo":"lima-vm/lima","slug":"can-check-only-a-single-sudoers-file","errorCode":null,"errorMessage":"can check only a single sudoers file","messagePattern":"can check only a single sudoers file","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/limactl/sudoers_darwin.go","lineNumber":64,"sourceCode":"\t\treturn err\n\t}\n\tfmt.Fprint(cmd.OutOrStdout(), sudoers)\n\treturn nil\n}\n\nfunc verifySudoAccess(ctx context.Context, nwCfg networks.Config, args []string, stdout io.Writer) error {\n\tvar file string\n\tswitch len(args) {\n\tcase 0:\n\t\tfile = nwCfg.Paths.Sudoers\n\t\tif file == \"\" {\n\t\t\tcfgFile, _ := networks.ConfigFile()\n\t\t\treturn fmt.Errorf(\"no sudoers file defined in %#q\", cfgFile)\n\t\t}\n\tcase 1:\n\t\tfile = args[0]\n\tdefault:\n\t\treturn errors.New(\"can check only a single sudoers file\")\n\t}\n\tif err := nwCfg.VerifySudoAccess(ctx, file); err != nil {\n\t\treturn err\n\t}\n\tfmt.Fprintf(stdout, \"%#q is up-to-date (or sudo doesn't require a password)\\n\", file)\n\treturn nil\n}\n","sourceCodeStart":46,"sourceCodeEnd":72,"githubUrl":"https://github.com/lima-vm/lima/blob/dd909d0973cd84fa35f9e1693181b4585ea616c1/cmd/limactl/sudoers_darwin.go#L46-L72","documentation":"Error returned by the `limactl sudoers --check`/verify path (verifySudoAccess in cmd/limactl/sudoers_darwin.go:64) when more than one sudoers file path is passed on the command line. The check accepts at most one explicit sudoers file argument: with zero arguments it falls back to the sudoers path configured in networks.yaml, and with exactly one it verifies that file. Passing two or more paths (e.g. `limactl sudoers --check a b`) triggers this error. Fix by supplying only a single sudoers file path, or no argument to use the configured default.","triggerScenarios":"`limactl sudoers --check fileA fileB` (2+ args).","commonSituations":"Trying to validate several sudoers fragments at once; shell glob expanding to multiple files, e.g. `limactl sudoers --check /etc/sudoers.d/*`.","solutions":["Pass only a single file path per invocation","Quote globs or loop over files, calling the command once per file","Omit the argument to check the configured path instead"],"exampleFix":"// before\nlimactl sudoers --check /etc/sudoers.d/lima /etc/sudoers.d/other\n// after\nfor f in /etc/sudoers.d/lima /etc/sudoers.d/other; do limactl sudoers --check \"$f\"; done","handlingStrategy":"validation","validationCode":"files=(/etc/sudoers.d/lima); [[ ${#files[@]} -eq 1 ]] || { echo 'pass exactly one file'; exit 2; }","typeGuard":null,"tryCatchPattern":"for f in /etc/sudoers.d/*; do limactl sudoers --check \"$f\" || echo \"check failed: $f\"; done","preventionTips":["One file per --check invocation","Quote globs to avoid multi-file expansion","Loop over files instead of batching"],"tags":["cli","macos","sudoers","argument-validation"],"backgroundTag":"invalid-cli-argument","analyzedSha":"dd909d0973cd84fa35f9e1693181b4585ea616c1","analyzedAt":"2026-09-01T14:24:59.842Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}