{"record":{"id":"d3857d36eda57949","repo":"hashicorp/nomad","slug":"expected-1-argument-got-v","errorCode":null,"errorMessage":"expected 1 argument, got %v","messagePattern":"expected 1 argument, got (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"command/eval_delete.go","lineNumber":189,"sourceCode":"\t}\n\n\treturn exitCode\n}\n\n// verifyArgsAndFlags ensures the passed arguments and flags are valid for what\n// this command accepts and can take action on.\nfunc (e *EvalDeleteCommand) verifyArgsAndFlags(args []string) error {\n\n\tnumArgs := len(args)\n\n\t// The command takes either an argument or filter, but not both.\n\tif (e.filter == \"\" && numArgs < 1) || (e.filter != \"\" && numArgs > 0) {\n\t\treturn errors.New(\"evaluation ID or filter flag required\")\n\t}\n\n\t// If an argument is supplied, we only accept a single eval ID.\n\tif numArgs > 1 {\n\t\treturn fmt.Errorf(\"expected 1 argument, got %v\", numArgs)\n\t}\n\n\treturn nil\n}\n\n// handleEvalArgDelete handles deletion and evaluation which was passed via\n// it's ID as a command argument. This is the simplest route to take and\n// doesn't require filtering or batching.\nfunc (e *EvalDeleteCommand) handleEvalArgDelete(evalID string) (int, error) {\n\tevalInfo, _, err := e.client.Evaluations().Info(evalID, nil)\n\tif err != nil {\n\t\treturn 1, err\n\t}\n\n\t// Supplying an eval to delete by its ID will always skip verification, so\n\t// we don't need to understand the boolean response.\n\tcode, _, err := e.batchDelete([]*api.Evaluation{evalInfo})\n\treturn code, err","sourceCodeStart":171,"sourceCodeEnd":207,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/command/eval_delete.go#L171-L207","documentation":"verifyArgsAndFlags in eval_delete.go enforces that the user supplies exactly one argument (an eval ID) when no -filter is given, or zero arguments when -filter is given. Passing more than one positional argument fails with \"expected 1 argument, got %v\".","triggerScenarios":"Running `nomad eval delete <id1> <id2>` or accidentally passing extra tokens (e.g. unquoted filter string splitting into multiple args).","commonSituations":"Trying to batch-delete multiple eval IDs in one command (unsupported); a shell word-splitting issue where a quoted expression became several arguments.","solutions":["Pass exactly one eval ID per invocation; loop over IDs in the shell for bulk deletes","Use -filter instead of listing IDs to delete many evaluations matching a criteria","Quote arguments containing spaces so they count as a single arg"],"exampleFix":"// before\nnomad eval delete id1 id2\n// after\nfor id in id1 id2; do nomad eval delete \"$id\"; done\n# or\nnomad eval delete -filter 'JobID == \"example\"'","handlingStrategy":"validation","validationCode":"if len(args) > 1 || (filter == \"\" && len(args) == 0) {\n    return fmt.Errorf(\"usage: nomad eval delete <eval-id> | nomad eval delete -filter <expr>\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Delete one eval per invocation; loop for bulk operations","Prefer -filter for bulk deletes","Quote arguments so shell word-splitting doesn't create extra args"],"tags":["cli","argument-validation","evals"],"backgroundTag":"too-many-arguments","analyzedSha":"482b49bf1aec006f089bcfc7e632d8f6ac303e5e","analyzedAt":"2026-09-04T07:54:14.808Z","contentChangedAt":"2026-09-04T07:54:14.808Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}