{"record":{"id":"64f7fa9ffb90e8f2","repo":"multica-ai/multica","slug":"invalid-sort-q-valid-values-s","errorCode":null,"errorMessage":"invalid --sort %q; valid values: %s","messagePattern":"invalid --sort %q; valid values: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/cmd/multica/cmd_issue.go","lineNumber":649,"sourceCode":"\t}\n\tif mdFlags, _ := cmd.Flags().GetStringSlice(\"metadata\"); len(mdFlags) > 0 {\n\t\tfilter, err := buildMetadataFilterQueryParam(mdFlags)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tparams.Set(\"metadata\", filter)\n\t}\n\tsortVal, _ := cmd.Flags().GetString(\"sort\")\n\tif sortVal != \"\" {\n\t\tvalid := false\n\t\tfor _, c := range validIssueSortColumns {\n\t\t\tif c == sortVal {\n\t\t\t\tvalid = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif !valid {\n\t\t\treturn fmt.Errorf(\"invalid --sort %q; valid values: %s\", sortVal, strings.Join(validIssueSortColumns, \", \"))\n\t\t}\n\t\tparams.Set(\"sort\", sortVal)\n\t}\n\tif v, _ := cmd.Flags().GetString(\"direction\"); v != \"\" {\n\t\td := strings.ToLower(v)\n\t\tif d != \"asc\" && d != \"desc\" {\n\t\t\treturn fmt.Errorf(\"invalid --direction %q; valid values: asc, desc\", v)\n\t\t}\n\t\t// position (the manual board order) is always ascending, so the server\n\t\t// ignores --direction for it. Reject the combination up front rather\n\t\t// than silently dropping the flag — a passed-but-ignored flag is a\n\t\t// footgun, especially in scripts.\n\t\tif sortVal == \"\" || sortVal == \"position\" {\n\t\t\treturn fmt.Errorf(\"--direction requires --sort to be one of %s; position (the default manual board order) is always ascending\", strings.Join(directionalIssueSortColumns, \", \"))\n\t\t}\n\t\tparams.Set(\"direction\", d)\n\t}\n","sourceCodeStart":631,"sourceCodeEnd":667,"githubUrl":"https://github.com/multica-ai/multica/blob/2c0912b6ec764b373d44eeea1e80f0d9f11ab417/server/cmd/multica/cmd_issue.go#L631-L667","documentation":"The --sort flag passed to `multica issue list` is not one of the recognized sort columns (validIssueSortColumns). Validation is client-side and happens before the query is sent, so no API request is wasted on a bad column name.","triggerScenarios":"Running `multica issue list --sort created` (instead of created_at), --sort title, --sort updated (vs updated_at), or any column name not in the valid set. Case matters: the comparison is exact string equality.","commonSituations":"Guessing column names from the JSON output fields (which may differ from sortable columns); scripts written against an older/newer CLI whose sort set changed; abbreviations like 'prio'.","solutions":["Use one of the values printed in the error message exactly (no abbreviation, correct case).","Omit --sort to get the default manual board order (position).","If you believe the column should be sortable, check the CLI's documented/help list — the valid set is fixed in validIssueSortColumns."],"exampleFix":"# before\nmultica issue list --sort created\n# after\nmultica issue list --sort created_at","handlingStrategy":"validation","validationCode":"# shell: whitelist the sort column before the call\n case \"$SORT\" in created_at|updated_at|priority|status) ;; *) echo \"bad --sort: $SORT\" >&2; exit 1;; esac\n# mirror the exact set the error message prints","typeGuard":"func isValidSort(col string, valid []string) bool {\n\tfor _, v := range valid {\n\t\tif col == v {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}","tryCatchPattern":null,"preventionTips":["Do not infer sortable columns from JSON output field names — check the CLI help/error listing.","Pin flag values in scripts to a known-good CLI version."],"tags":["cli","validation","sorting","issue-list"],"backgroundTag":null,"analyzedSha":"2c0912b6ec764b373d44eeea1e80f0d9f11ab417","analyzedAt":"2026-08-15T13:25:18.241Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}