{"record":{"id":"f138f543c2a6ee54","repo":"slimtoolkit/slim","slug":"invalid-operation-s","errorCode":null,"errorMessage":"invalid operation - %s","messagePattern":"invalid operation - (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/app/master/command/vulnerability/cli.go","lineNumber":116,"sourceCode":"\t\treturn nil, err\n\t}\n\n\tvalues := &EpssCommandParams{\n\t\tCommonCommandParams:  common,\n\t\tOp:                   ctx.String(FlagOp),\n\t\tWithHistory:          ctx.Bool(FlagWithHistory),\n\t\tLimit:                ctx.Uint64(FlagLimit),\n\t\tOffset:               ctx.Uint64(FlagOffset),\n\t\tFilterCveIDPattern:   ctx.String(FlagFilterCveIDPattern),\n\t\tFilterDaysSinceAdded: ctx.Uint(FlagFilterDaysSinceAdded),\n\t\tFilterScoreGt:        ctx.Float64(FlagFilterScoreGt),\n\t\tFilterScoreLt:        ctx.Float64(FlagFilterScoreLt),\n\t\tFilterPercentileGt:   ctx.Float64(FlagFilterPercentileGt),\n\t\tFilterPercentileLt:   ctx.Float64(FlagFilterPercentileLt),\n\t}\n\n\tif !IsValidOp(values.Op) {\n\t\treturn nil, fmt.Errorf(\"invalid operation - %s\", values.Op)\n\t}\n\n\tif orderStr := ctx.String(FlagFilterOrderRecords); orderStr != \"\" {\n\t\tif !IsValidOrderRecordsValue(orderStr) {\n\t\t\treturn nil, fmt.Errorf(\"invalid order records value - %s\", orderStr)\n\t\t}\n\n\t\tvalues.FilterOrderRecords = OrderType(orderStr)\n\t}\n\n\tif dateStr := ctx.String(FlagDate); dateStr != \"\" {\n\t\tdate, err := epss.DateFromString(dateStr)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tvalues.Date = date\n\t}","sourceCodeStart":98,"sourceCodeEnd":134,"githubUrl":"https://github.com/slimtoolkit/slim/blob/81940d17fa112cc678e32209214bcb2355cb3004/pkg/app/master/command/vulnerability/cli.go#L98-L134","documentation":"The 'vulnerability epss' command validates its --op flag value when parsing CLI flags via EpssCommandFlagValues (pkg/app/master/command/vulnerability/cli.go:115). The op value must be exactly one of the accepted operations (EpssOpLookup or EpssOpList); anything else makes IsValidOp return false and the command returns \"invalid operation - %s\" before doing any work. This is an early, deliberate validation failure that stops the CLI with a bad-usage error.","triggerScenarios":"Running 'slim vulnerability epss' with a missing or misspelled --op flag value (e.g. --op=find, --op=look, or omitting --op entirely so it defaults to the empty string). Any value other than 'lookup' or 'list' triggers it.","commonSituations":"Typos or abbreviated op names on the command line; scripts written against an older CLI version whose op names changed; forgetting the --op flag in a wrapper script so Op is \"\"; IDE or docs showing outdated examples.","solutions":["Set --op to an accepted value: 'lookup' or 'list' (see EpssOpLookup/EpssOpList constants).","If --op was omitted, add it explicitly — the empty string fails IsValidOp.","Check 'slim vulnerability epss --help' for the currently supported op values, since names can change between versions.","If calling EpssCommandFlagValues programmatically, validate the ctx.String(FlagOp) value against vulnerability.IsValidOp before invoking it."],"exampleFix":"// before\nslim vulnerability epss --op=look\n// after\nslim vulnerability epss --op=lookup","handlingStrategy":"validation","validationCode":"const validOps = map[string]bool{\"lookup\": true, \"list\": true}\nop := ctx.String(\"op\")\nif !validOps[op] {\n    return fmt.Errorf(\"unsupported --op %q; use lookup or list\", op)\n}","typeGuard":"func isValidOp(op string) bool {\n    return op == \"lookup\" || op == \"list\"\n}","tryCatchPattern":"params, err := vulnerability.EpssCommandFlagValues(ctx)\nif err != nil {\n    if strings.HasPrefix(err.Error(), \"invalid operation\") {\n        fmt.Fprintf(os.Stderr, \"usage: --op must be lookup|list (got: %v)\\n\", err)\n        os.Exit(2)\n    }\n    return err\n}","preventionTips":["Always pass --op explicitly in scripts; never rely on defaults.","Keep op values in shell variables sourced from --help output.","Add a smoke test that runs the epss subcommand with each supported op.","Pin the slim version in CI so flag semantics don't drift."],"tags":["cli","flag-validation","slimtoolkit"],"backgroundTag":"invalid-cli-flag-value","analyzedSha":"81940d17fa112cc678e32209214bcb2355cb3004","analyzedAt":"2026-08-31T23:06:12.682Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}