go-task/task · error
task: --no-status only applies to --json with --list or --li
Error message
task: --no-status only applies to --json with --list or --list-all
What it means
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.
Source
Thrown at internal/flags/flags.go:237
}
if Output.Group.End != "" {
return errors.New("task: You can't set --output-group-end without --output=group")
}
if Output.Group.ErrorOnly {
return errors.New("task: You can't set --output-group-error-only without --output=group")
}
}
if List && ListAll {
return errors.New("task: cannot use --list and --list-all at the same time")
}
if ListJson && !List && !ListAll {
return errors.New("task: --json only applies to --list or --list-all")
}
if NoStatus && !ListJson {
return errors.New("task: --no-status only applies to --json with --list or --list-all")
}
if Nested && !ListJson {
return errors.New("task: --nested only applies to --json with --list or --list-all")
}
// Validate certificate flags
if (Cert != "" && CertKey == "") || (Cert == "" && CertKey != "") {
return errors.New("task: --cert and --cert-key must be provided together")
}
return nil
}
// WithFlags is a special internal functional option that is used to pass flags
// from the CLI into any constructor that accepts functional options.
func WithFlags() task.ExecutorOption {
return &flagsOption{}View on GitHub (pinned to 385e5ad92a)
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
Example fix
# before task --list --nested # after task --list --json --nested
Defensive patterns
Strategy: validation
Validate before calling
if flags.Nested && !flags.ListJson {
return errors.New("--nested requires --json with --list or --list-all")
} Try / catch
if err := flags.Validate(); err != nil {
if strings.Contains(err.Error(), "--nested only applies") {
fmt.Fprintln(os.Stderr, "use: task --list --json --nested")
os.Exit(2)
}
return err
} Prevention
- 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
When it happens
Trigger: Running `task --nested` (or with --list/--list-all but no --json) so Nested is true while ListJson is false when Validate() executes.
Common situations: Scripts that print nested task trees but dropped the --json flag during refactoring; misunderstanding that --nested works with the default text output.
Understand the failure class
Background: "mutually exclusive" flag errors: what "can't supply both nx and xx", "--raw is not compatible with -i" and "cannot be used with" mean, and how to fix them — this error's family across 29 libraries.
Related errors
- task: cannot use --list and --list-all at the same time
- task: --json only applies to --list or --list-all
- task: You can't set both --download and --offline flags
- task: You can't set both --download and --clear-cache flags
- task: You can't set both --global and --dir
AI-assisted analysis of go-task/task@385e5ad92a (2026-09-05).
Data as JSON: /api/errors/2d21beb127a7b2f7.
Report an issue: GitHub.