{"record":{"id":"2d21beb127a7b2f7","repo":"go-task/task","slug":"task-no-status-only-applies-to-json-with-li","errorCode":null,"errorMessage":"task: --no-status only applies to --json with --list or --list-all","messagePattern":"task: --no-status only applies to --json with --list or --list-all","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/flags/flags.go","lineNumber":237,"sourceCode":"\t\t}\n\t\tif Output.Group.End != \"\" {\n\t\t\treturn errors.New(\"task: You can't set --output-group-end without --output=group\")\n\t\t}\n\t\tif Output.Group.ErrorOnly {\n\t\t\treturn errors.New(\"task: You can't set --output-group-error-only without --output=group\")\n\t\t}\n\t}\n\n\tif List && ListAll {\n\t\treturn errors.New(\"task: cannot use --list and --list-all at the same time\")\n\t}\n\n\tif ListJson && !List && !ListAll {\n\t\treturn errors.New(\"task: --json only applies to --list or --list-all\")\n\t}\n\n\tif NoStatus && !ListJson {\n\t\treturn errors.New(\"task: --no-status only applies to --json with --list or --list-all\")\n\t}\n\n\tif Nested && !ListJson {\n\t\treturn errors.New(\"task: --nested only applies to --json with --list or --list-all\")\n\t}\n\n\t// Validate certificate flags\n\tif (Cert != \"\" && CertKey == \"\") || (Cert == \"\" && CertKey != \"\") {\n\t\treturn errors.New(\"task: --cert and --cert-key must be provided together\")\n\t}\n\n\treturn nil\n}\n\n// WithFlags is a special internal functional option that is used to pass flags\n// from the CLI into any constructor that accepts functional options.\nfunc WithFlags() task.ExecutorOption {\n\treturn &flagsOption{}","sourceCodeStart":219,"sourceCodeEnd":255,"githubUrl":"https://github.com/go-task/task/blob/385e5ad92af02877b6d7cf9dcc963b5ed916e70a/internal/flags/flags.go#L219-L255","documentation":"Flag validation error raised by the Validate function after CLI parsing before task execution. It fires when --no-status is supplied but --json is not, i.e. the user has not combined it with --list/--list-all plus --json; --no-status (omit status column from JSON listing) is only meaningful in JSON list output, so the tool rejects it as a no-op. Fix by using --no-status only alongside --json with --list or --list-all.","triggerScenarios":"Running `task --nested` (or with --list/--list-all but no --json) so Nested is true while ListJson is false when Validate() executes.","commonSituations":"Scripts that print nested task trees but dropped the --json flag during refactoring; misunderstanding that --nested works with the default text output.","solutions":["Use `--json --list --nested` (or with --list-all) together","Remove --nested if you don't need nested JSON listing","Update wrappers to gate --nested on the JSON listing flags being present"],"exampleFix":"# before\ntask --list --nested\n\n# after\ntask --list --json --nested","handlingStrategy":"validation","validationCode":"if flags.Nested && !flags.ListJson {\n\treturn errors.New(\"--nested requires --json with --list or --list-all\")\n}","typeGuard":null,"tryCatchPattern":"if err := flags.Validate(); err != nil {\n\tif strings.Contains(err.Error(), \"--nested only applies\") {\n\t\tfmt.Fprintln(os.Stderr, \"use: task --list --json --nested\")\n\t\tos.Exit(2)\n\t}\n\treturn err\n}","preventionTips":["Treat --nested as part of the JSON listing flag bundle","Keep the triple --list --json --nested together in scripts","Verify --json precedes/is present with --nested in documented examples"],"tags":["cli","flags","json","go-task"],"backgroundTag":"mutually-exclusive-flags","analyzedSha":"385e5ad92af02877b6d7cf9dcc963b5ed916e70a","analyzedAt":"2026-09-05T09:01:05.226Z","contentChangedAt":"2026-09-05T09:01:05.226Z","schemaVersion":2},"datasetVersion":"2026-09-12T12:17:11.808Z"}