go-task/task · error

task: Blank Arch value provided

Error message

task: Blank Arch value provided

What it means

Task's platform filter parser rejects an empty architecture value. When a `platforms:` entry is split into OS and arch parts, the arch part must be a non-empty string; a blank arch means the platform entry was malformed (e.g. a trailing comma). The library throws this to fail fast instead of silently matching nothing.

Source

Thrown at taskfile/ast/platforms.go:91

// 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. Fix the platforms entry in the Taskfile so it contains a valid arch, e.g. `platforms: [linux]` instead of `platforms: [linux,]`
  2. If the platform is OS-only, list just the OS (e.g. `linux`) — arch is optional but must not be blank
  3. If the arch comes from a template/variable, ensure the variable is set and non-empty before rendering
  4. Run `task --list` after editing to confirm the Taskfile parses cleanly

Example fix

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

Strategy: validation

Validate before calling

for _, p := range platforms {
    parts := strings.Split(p, "/")
    if len(parts) > 1 && parts[1] == "" {
        return fmt.Errorf("blank arch in platform entry %q", p)
    }
}

Type guard

func hasBlankArch(entries []string) bool {
    for _, e := range entries {
        if i := strings.Index(e, "/"); i >= 0 && i == len(e)-1 {
            return true
        }
    }
    return false
}

Try / catch

if err := parsePlatform(...); err != nil {
    if strings.Contains(err.Error(), "Blank Arch value provided") {
        // fall back: skip malformed platform entry and log
    }
    return err
}

Prevention

When it happens

Trigger: Calling parseArch (via parsePlatform when evaluating a task's `platforms:` list) with an empty arch string, e.g. a platform entry like `linux,` or `windows-` where the component after the separator is empty.

Common situations: Hand-edited Taskfiles with a trailing comma in a platforms entry; templated/generated platform lists where a variable that holds the arch expanded to empty; copy-paste of platform strings with a stray separator.

Related errors


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