{"record":{"id":"d9cdfeefae8154ce","repo":"multica-ai/multica","slug":"direction-requires-sort-to-be-one-of-s-posit","errorCode":null,"errorMessage":"--direction requires --sort to be one of %s; position (the default manual board order) is always ascending","messagePattern":"--direction requires --sort to be one of (.+?); position \\(the default manual board order\\) is always ascending","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/cmd/multica/cmd_issue.go","lineNumber":663,"sourceCode":"\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\n\tpath := \"/api/issues\"\n\tif len(params) > 0 {\n\t\tpath += \"?\" + params.Encode()\n\t}\n\n\tvar result map[string]any\n\tif err := client.GetJSON(ctx, path, &result); err != nil {\n\t\treturn fmt.Errorf(\"list issues: %w\", err)\n\t}\n\n\tissuesRaw, _ := result[\"issues\"].([]any)\n\n\toutput, _ := cmd.Flags().GetString(\"output\")\n\tif output == \"json\" {","sourceCodeStart":645,"sourceCodeEnd":681,"githubUrl":"https://github.com/multica-ai/multica/blob/2c0912b6ec764b373d44eeea1e80f0d9f11ab417/server/cmd/multica/cmd_issue.go#L645-L681","documentation":"--direction was passed but --sort is either empty or 'position'. Position is the manual board order and is always ascending — the server ignores --direction for it — so the CLI rejects the combination up front rather than silently dropping a flag the user explicitly passed. The message names the sort columns that do accept a direction (directionalIssueSortColumns).","triggerScenarios":"Running `multica issue list --direction desc` with no --sort, or `--sort position --direction desc`. Both hit the sortVal == \"\" || sortVal == \"position\" branch after the asc/desc check passes.","commonSituations":"A script that always passes --direction desc for 'newest first' habits, without realizing the default sort is the board position; combining flags copied from two different examples.","solutions":["Pair --direction with a directional sort column from the list in the message, e.g. --sort created_at --direction desc for newest first.","If you actually want the manual board order, remove --direction.","Audit scripts for unconditional --direction flags and make them conditional on an explicit --sort."],"exampleFix":"# before\nmultica issue list --direction desc\n# after\nmultica issue list --sort created_at --direction desc","handlingStrategy":"validation","validationCode":"# direction only makes sense with a directional sort column\n[ -z \"$DIRECTION\" ] || { [ -n \"$SORT\" ] && [ \"$SORT\" != position ]; } \\\n  || { echo \"--direction needs a non-position --sort\" >&2; exit 1; }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never pass --direction unconditionally; pair it with an explicit --sort.","For newest-first use --sort created_at --direction desc instead of relying on defaults."],"tags":["cli","validation","sorting","issue-list","flag-combination"],"backgroundTag":null,"analyzedSha":"2c0912b6ec764b373d44eeea1e80f0d9f11ab417","analyzedAt":"2026-08-15T13:25:18.241Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}