go-task/task · error

task: You can't set --output-group-error-only without --outp

Error message

task: You can't set --output-group-error-only without --output=group

What it means

Flag validation error raised by the Validate function after CLI parsing before task execution. It fires when --output-group-error-only (suppress non-error output, show only failing task output) is set without --output=group, since this option only applies in group output mode. Fix by adding --output=group or removing --output-group-error-only.

Source

Thrown at internal/flags/flags.go:224

	}

	if Download && ClearCache {
		return errors.New("task: You can't set both --download and --clear-cache flags")
	}

	if Global && Dir != "" {
		return errors.New("task: You can't set both --global and --dir")
	}

	if Output.Name != "group" {
		if Output.Group.Begin != "" {
			return errors.New("task: You can't set --output-group-begin without --output=group")
		}
		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")
	}

View on GitHub (pinned to 385e5ad92a)

Solutions

  1. Add `--output=group` to the invocation
  2. Remove --output-group-error-only if you don't use group output
  3. Check Taskfile/config that may set output style independently of CLI flags

Example fix

# before
task --output-group-error-only

# after
task --output group --output-group-error-only
Defensive patterns

Strategy: validation

Validate before calling

if flags.Output.Name != "group" && flags.Output.Group.ErrorOnly {
	return errors.New("--output-group-error-only requires --output=group")
}

Try / catch

if err := flags.Validate(); err != nil {
	if strings.Contains(err.Error(), "--output-group-error-only") {
		fmt.Fprintln(os.Stderr, "add --output=group or drop --output-group-error-only")
		os.Exit(2)
	}
	return err
}

Prevention

When it happens

Trigger: Running `task --output-group-error-only` without `--output=group`, i.e. Output.Group.ErrorOnly is true while Output.Name != "group".

Common situations: CI scripts enabling error-only output for quieter logs but forgetting the group style; combining the flag with a default or prefixed output set elsewhere in a Taskfile/config.

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


AI-assisted analysis of go-task/task@385e5ad92a (2026-09-05). Data as JSON: /api/errors/11e332c83fe80edf. Report an issue: GitHub.