{"record":{"id":"35123ced482b272e","repo":"lima-vm/lima","slug":"unexpected-arguments-v","errorCode":null,"errorMessage":"unexpected arguments %v","messagePattern":"unexpected arguments (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/limactl/sudoers_darwin.go","lineNumber":42,"sourceCode":"\t// Make sure the current network configuration is secure\n\tif err := nwCfg.Validate(); err != nil {\n\t\tlogrus.Infof(\"Please check %s for more information.\", socketVMNetURL)\n\t\treturn err\n\t}\n\tcheck, err := cmd.Flags().GetBool(\"check\")\n\tif err != nil {\n\t\treturn err\n\t}\n\tif check {\n\t\treturn verifySudoAccess(ctx, nwCfg, args, cmd.OutOrStdout())\n\t}\n\tswitch len(args) {\n\tcase 0:\n\t\t// NOP\n\tcase 1:\n\t\treturn errors.New(\"the file argument can be specified only for --check mode\")\n\tdefault:\n\t\treturn fmt.Errorf(\"unexpected arguments %v\", args)\n\t}\n\tsudoers, err := networks.Sudoers()\n\tif err != nil {\n\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}","sourceCodeStart":24,"sourceCodeEnd":60,"githubUrl":"https://github.com/lima-vm/lima/blob/dd909d0973cd84fa35f9e1693181b4585ea616c1/cmd/limactl/sudoers_darwin.go#L24-L60","documentation":"`limactl sudoers` (macOS, non-check mode) accepts at most zero arguments; two or more positional arguments are rejected with this error listing them. The command's job is only to emit the sudoers file content.","triggerScenarios":"`limactl sudoers foo bar` (2+ args) without --check mode.","commonSituations":"Pasting multiple paths or extra tokens into the command; scripting mistakes that append extra arguments; confusing this command with `limactl sudoers --check <file>`.","solutions":["Remove the extra positional arguments","Use `limactl sudoers` with no args to print the rules","Use `limactl sudoers --check <one-file>` to verify a single file"],"exampleFix":"// before\nlimactl sudoers /etc/sudoers.d/lima extra\n// after\nlimactl sudoers","handlingStrategy":"validation","validationCode":"[[ $# -le 1 ]] || { echo 'sudoers accepts at most one arg (only with --check)'; exit 2; }","typeGuard":null,"tryCatchPattern":"if ! out=$(limactl sudoers 2>&1); then echo \"$out\"; fi","preventionTips":["Call `limactl sudoers` with no positional args","Quote file paths so globs don't add arguments","Verify arg count in wrapper scripts"],"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"}