go-task/task · error

task: Multiple Arch values provided

Error message

task: Multiple Arch values provided

What it means

A task's platform filter can only declare one architecture. parseArch sets p.Arch once; a second call with another arch value means the same Platform entry received two arch values, which is ambiguous, so it errors.

Source

Thrown at taskfile/ast/platforms.go:94

		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. Split combined entries into separate list items: `platforms: [linux/amd64, linux/arm64]`
  2. Remove the duplicate arch from the single entry so each entry has exactly one os/arch pair
  3. Check for accidental repeated separators (e.g. `windows/amd64/amd64`)
  4. Validate with `task --list` after fixing

Example fix

# before
platforms:
  - linux/amd64/arm64
# after
platforms:
  - linux/amd64
  - linux/arm64
Defensive patterns

Strategy: validation

Validate before calling

for _, p := range platforms {
    if strings.Count(p, "/") > 1 {
        return fmt.Errorf("platform entry %q has more than one arch", p)
    }
}

Type guard

func hasMultipleArch(e string) bool {
    return strings.Count(e, "/") > 1
}

Try / catch

if err := parsePlatform(...); err != nil {
    if strings.Contains(err.Error(), "Multiple Arch values provided") {
        // split the entry into multiple platforms before retrying
    }
    return err
}

Prevention

When it happens

Trigger: parsePlatform feeding multiple arch tokens into parseArch for the same Platform struct — e.g. a platforms entry like `linux/amd64/arm64` or calling the parser twice with different arch strings on the same Platform instance.

Common situations: Typos in platform entries where a second slash-separated component was meant to be an OS; misunderstanding that each entry is a single os/arch pair (multiple entries, not one combined entry, express multiple platforms).

Related errors


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