{"record":{"id":"3c4f560ce82ccae1","repo":"slimtoolkit/slim","slug":"invalid-order-records-value-s","errorCode":null,"errorMessage":"invalid order records value - %s","messagePattern":"invalid order records value - (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/app/master/command/vulnerability/cli.go","lineNumber":121,"sourceCode":"\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}\n\n\treturn values, nil\n}\n\nvar CLI = &cli.Command{","sourceCodeStart":103,"sourceCodeEnd":139,"githubUrl":"https://github.com/slimtoolkit/slim/blob/81940d17fa112cc678e32209214bcb2355cb3004/pkg/app/master/command/vulnerability/cli.go#L103-L139","documentation":"The 'vulnerability epss' command validates the optional --filter-order-records flag in EpssCommandFlagValues (pkg/app/master/command/vulnerability/cli.go:121). When the flag is non-empty it must match one of score-desc, score-asc, percentile-desc, or percentile-asc; otherwise IsValidOrderRecordsValue returns false and the CLI returns \"invalid order records value - %s\". Unlike the op flag, an empty value is accepted (meaning no ordering).","triggerScenarios":"Running 'slim vulnerability epss' with --filter-order-records set to a non-empty string that is not one of the four accepted order values (e.g. --filter-order-records=score, --filter-order-records=Score-Desc, --filter-order-records=desc).","commonSituations":"Case mismatch (uppercase letters); abbreviated ordering names like 'score' instead of 'score-desc'; shell scripts carrying values from an older CLI syntax; confusing this flag's underscore/dash naming with other filter flags.","solutions":["Use exactly one of: score-desc, score-asc, percentile-desc, percentile-asc.","Make sure the value is lowercase — matching is a plain string comparison, not case-insensitive.","If you don't need ordering, omit the flag entirely (empty is valid).","Run 'slim vulnerability epss --help' to confirm accepted values for your installed version."],"exampleFix":"// before\nslim vulnerability epss --op=list --filter-order-records=Score-Desc\n// after\nslim vulnerability epss --op=list --filter-order-records=score-desc","handlingStrategy":"validation","validationCode":"var validOrders = map[string]bool{\n    \"score-desc\": true, \"score-asc\": true,\n    \"percentile-desc\": true, \"percentile-asc\": true,\n}\nif o := ctx.String(\"filter-order-records\"); o != \"\" && !validOrders[o] {\n    return fmt.Errorf(\"unsupported --filter-order-records %q\", o)\n}","typeGuard":"func isValidOrder(o string) bool {\n    switch o {\n    case \"score-desc\", \"score-asc\", \"percentile-desc\", \"percentile-asc\":\n        return true\n    }\n    return false\n}","tryCatchPattern":"params, err := vulnerability.EpssCommandFlagValues(ctx)\nif err != nil {\n    if strings.HasPrefix(err.Error(), \"invalid order records value\") {\n        fmt.Fprintf(os.Stderr, \"--filter-order-records must be score-desc|score-asc|percentile-desc|percentile-asc\\n\")\n        os.Exit(2)\n    }\n    return err\n}","preventionTips":["Use the exact lowercase constants (score-desc, etc.) — matching is case-sensitive.","Omit the flag when no ordering is needed rather than passing a guess value.","Wrap CLI invocations in helper functions that expose typed order enums.","Validate flag values in wrapper scripts before exec'ing the CLI."],"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"}