go-task/task · error

task: output style %q not recognized

Error message

task: output style %q not recognized

What it means

The `output:` option in a Taskfile is validated against the supported styles (interleaved, group, prefixed). BuildFor returns this error when o.Name doesn't match any known style. It surfaces during executor setup via setupOutput, before any task runs.

Source

Thrown at internal/output/output.go:38

	switch o.Name {
	case "interleaved", "":
		if err := checkOutputGroupUnset(o); err != nil {
			return nil, err
		}
		return Interleaved{}, nil
	case "group":
		return Group{
			Begin:     o.Group.Begin,
			End:       o.Group.End,
			ErrorOnly: o.Group.ErrorOnly,
		}, nil
	case "prefixed":
		if err := checkOutputGroupUnset(o); err != nil {
			return nil, err
		}
		return NewPrefixed(logger), nil
	default:
		return nil, fmt.Errorf(`task: output style %q not recognized`, o.Name)
	}
}

func checkOutputGroupUnset(o *ast.Output) error {
	if o.Group.IsSet() {
		return fmt.Errorf("task: output style %q does not support the group begin/end parameter", o.Name)
	}
	return nil
}

View on GitHub (pinned to 385e5ad92a)

Solutions

  1. Use a supported output style: interleaved, group, or prefixed
  2. Remove the `output:` key to fall back to the default (interleaved) behavior
  3. Check your Task version's docs — newer styles may not exist in older releases

Example fix

# before
output: grouped
# after
output: group
Defensive patterns

Strategy: validation

Validate before calling

var validOutputStyles = map[string]bool{"interleaved":true,"group":true,"prefixed":true}
if o := taskDef.Output; o != nil && !validOutputStyles[o.Style] {
  return fmt.Errorf("unknown output style %q", o.Style)
}

Try / catch

err := t.Run(ctx)
if err != nil && strings.Contains(err.Error(), "output style") {
  // strip output: key (default interleaved) and retry
}

Prevention

When it happens

Trigger: A task or Taskfile sets `output: <style>` with an unrecognized style name, and setupOutput calls output.BuildFor to construct the output wrapper.

Common situations: Typos like `output: prefix` or `output: grouped`, inventing styles not in the current Task version (e.g. `output: json`), or mixed-case values (`output: Group`).

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


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