go-task/task · error

task: Blank OS/Arch value provided

Error message

task: Blank OS/Arch value provided

What it means

The `platforms:` list validates each entry as either a known OS or a known Arch. parseOsOrArch rejects an empty string immediately with this error, because a blank entry carries no meaning and usually signals malformed YAML. It is raised while parsing a platform entry into a Platform struct.

Source

Thrown at taskfile/ast/platforms.go:76

	if len(splitValues) > 2 {
		return &ErrInvalidPlatform{Platform: input}
	}
	if err := p.parseOsOrArch(splitValues[0]); err != nil {
		return &ErrInvalidPlatform{Platform: input}
	}
	if len(splitValues) == 2 {
		if err := p.parseArch(splitValues[1]); err != nil {
			return &ErrInvalidPlatform{Platform: input}
		}
	}
	return nil
}

// parseOsOrArch will check if the given input is a valid OS or Arch value.
// If so, it will store it. If not, an error is returned
func (p *Platform) parseOsOrArch(osOrArch string) error {
	if osOrArch == "" {
		return fmt.Errorf("task: Blank OS/Arch value provided")
	}
	if goext.IsKnownOS(osOrArch) {
		p.OS = osOrArch
		return nil
	}
	if goext.IsKnownArch(osOrArch) {
		p.Arch = osOrArch
		return nil
	}
	return fmt.Errorf("task: Invalid OS/Arch value provided (%s)", osOrArch)
}

func (p *Platform) parseArch(arch string) error {
	if arch == "" {
		return fmt.Errorf("task: Blank Arch value provided")
	}
	if p.Arch != "" {
		return fmt.Errorf("task: Multiple Arch values provided")

View on GitHub (pinned to 385e5ad92a)

Solutions

  1. Remove the empty entry from the platforms list
  2. Fill in a valid value like `linux`, `darwin`, `windows`, `amd64`, or a combined `os/arch` form (e.g. `linux/amd64`)
  3. Inspect the raw YAML for dangling `- ` lines or unexpanded template variables

Example fix

# before
platforms:
  - linux
  -
# after
platforms:
  - linux
  - darwin
Defensive patterns

Strategy: validation

Validate before calling

for i, p := range taskDef.Platforms {
  if strings.TrimSpace(p) == "" {
    return fmt.Errorf("platforms[%d] is empty", i)
  }
}

Try / catch

err := t.Run(ctx)
if err != nil && strings.Contains(err.Error(), "Blank OS/Arch") {
  // clean the platforms list and reload the Taskfile
}

Prevention

When it happens

Trigger: A task's `platforms:` array contains an empty string element (e.g. a stray `- ` line or `- ''`) — parsePlatform calls parseOsOrArch with "" and fails.

Common situations: YAML list items accidentally left empty after editing, templating tools generating `- {{var}}` where the variable is empty, trailing comma/space artifacts, or copy-paste leaving a dangling dash.

Related errors


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