lima-vm/lima · error
unexpected arguments %v
Error message
unexpected arguments %v
What it means
`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.
Source
Thrown at cmd/limactl/sudoers_darwin.go:42
// Make sure the current network configuration is secure
if err := nwCfg.Validate(); err != nil {
logrus.Infof("Please check %s for more information.", socketVMNetURL)
return err
}
check, err := cmd.Flags().GetBool("check")
if err != nil {
return err
}
if check {
return verifySudoAccess(ctx, nwCfg, args, cmd.OutOrStdout())
}
switch len(args) {
case 0:
// NOP
case 1:
return errors.New("the file argument can be specified only for --check mode")
default:
return fmt.Errorf("unexpected arguments %v", args)
}
sudoers, err := networks.Sudoers()
if err != nil {
return err
}
fmt.Fprint(cmd.OutOrStdout(), sudoers)
return nil
}
func verifySudoAccess(ctx context.Context, nwCfg networks.Config, args []string, stdout io.Writer) error {
var file string
switch len(args) {
case 0:
file = nwCfg.Paths.Sudoers
if file == "" {
cfgFile, _ := networks.ConfigFile()
return fmt.Errorf("no sudoers file defined in %#q", cfgFile)
}View on GitHub (pinned to dd909d0973)
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
Example fix
// before limactl sudoers /etc/sudoers.d/lima extra // after limactl sudoers
Defensive patterns
Strategy: validation
Validate before calling
[[ $# -le 1 ]] || { echo 'sudoers accepts at most one arg (only with --check)'; exit 2; } Try / catch
if ! out=$(limactl sudoers 2>&1); then echo "$out"; fi
Prevention
- Call `limactl sudoers` with no positional args
- Quote file paths so globs don't add arguments
- Verify arg count in wrapper scripts
When it happens
Trigger: `limactl sudoers foo bar` (2+ args) without --check mode.
Common situations: Pasting multiple paths or extra tokens into the command; scripting mistakes that append extra arguments; confusing this command with `limactl sudoers --check <file>`.
Understand the failure class
Background: "Unknown argument", "Invalid value", and "must be one of": invalid CLI argument errors explained — this error's family across 35 libraries.
Related errors
- the file argument can be specified only for --check mode
- can check only a single sudoers file
- no sudoers file defined in %#q
- sudoers command is only supported on macOS right now
- limactl is running under rosetta, please reinstall lima with
AI-assisted analysis of lima-vm/lima@dd909d0973 (2026-09-01).
Data as JSON: /api/errors/35123ced482b272e.
Report an issue: GitHub.