go-task/task · error

task: Invalid OS/Arch value provided (%s)

Error message

task: Invalid OS/Arch value provided (%s)

What it means

After failing to match the input as a known OS or a known Arch, parseOsOrArch returns this error with the offending value, since each platforms: entry must be a recognizable OS or architecture string. It signals a typo or unsupported platform token in the Taskfile. Validation is delegated to goext.IsKnownOS / IsKnownArch.

Source

Thrown at taskfile/ast/platforms.go:86

	}
	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")
	}
	if goext.IsKnownArch(arch) {
		p.Arch = arch
		return nil
	}
	return fmt.Errorf("task: Invalid Arch value provided (%s)", arch)
}

View on GitHub (pinned to 385e5ad92a)

Solutions

  1. Use exact Go runtime names: OS = linux, darwin, windows, freebsd, etc.; Arch = amd64, arm64, 386, arm, etc.
  2. Prefer combined `os/arch` entries (e.g. `linux/amd64`, `windows/amd64`) which parse both halves explicitly
  3. Check go/runtime constants or `go tool dist list` for the canonical OS/ARCH spellings

Example fix

# before
platforms:
  - mac
  - win
# after
platforms:
  - darwin
  - windows/amd64
Defensive patterns

Strategy: validation

Validate before calling

var knownOS = map[string]bool{"linux":true,"darwin":true,"windows":true,"freebsd":true}
var knownArch = map[string]bool{"amd64":true,"arm64":true,"386":true,"arm":true}
for _, p := range taskDef.Platforms {
  parts := strings.SplitN(p, "/", 2)
  if !(knownOS[parts[0]] || knownArch[parts[0]]) {
    return fmt.Errorf("unknown platform token %q", p)
  }
}

Try / catch

err := t.Run(ctx)
if err != nil && strings.Contains(err.Error(), "Invalid OS/Arch value") {
  // correct the platform token (use GOOS/GOARCH spellings) and retry
}

Prevention

When it happens

Trigger: A `platforms:` entry like `linuxs`, `mac`, `win64`, or any token not recognized by goext.IsKnownOS/IsKnownArch reaches the final return in parseOsOrArch.

Common situations: Using friendly OS names (`mac` instead of `darwin`, `win` instead of `windows`), misspellings (`linx`, `amd`), invented arch names (`x64` instead of `amd64`), or case-sensitivity surprises.

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/7433011647df100f. Report an issue: GitHub.