{"record":{"id":"e96c3ee85169182d","repo":"go-task/task","slug":"task-blank-os-arch-value-provided","errorCode":null,"errorMessage":"task: Blank OS/Arch value provided","messagePattern":"task: Blank OS/Arch value provided","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"taskfile/ast/platforms.go","lineNumber":76,"sourceCode":"\tif len(splitValues) > 2 {\n\t\treturn &ErrInvalidPlatform{Platform: input}\n\t}\n\tif err := p.parseOsOrArch(splitValues[0]); err != nil {\n\t\treturn &ErrInvalidPlatform{Platform: input}\n\t}\n\tif len(splitValues) == 2 {\n\t\tif err := p.parseArch(splitValues[1]); err != nil {\n\t\t\treturn &ErrInvalidPlatform{Platform: input}\n\t\t}\n\t}\n\treturn nil\n}\n\n// parseOsOrArch will check if the given input is a valid OS or Arch value.\n// If so, it will store it. If not, an error is returned\nfunc (p *Platform) parseOsOrArch(osOrArch string) error {\n\tif osOrArch == \"\" {\n\t\treturn fmt.Errorf(\"task: Blank OS/Arch value provided\")\n\t}\n\tif goext.IsKnownOS(osOrArch) {\n\t\tp.OS = osOrArch\n\t\treturn nil\n\t}\n\tif goext.IsKnownArch(osOrArch) {\n\t\tp.Arch = osOrArch\n\t\treturn nil\n\t}\n\treturn fmt.Errorf(\"task: Invalid OS/Arch value provided (%s)\", osOrArch)\n}\n\nfunc (p *Platform) parseArch(arch string) error {\n\tif arch == \"\" {\n\t\treturn fmt.Errorf(\"task: Blank Arch value provided\")\n\t}\n\tif p.Arch != \"\" {\n\t\treturn fmt.Errorf(\"task: Multiple Arch values provided\")","sourceCodeStart":58,"sourceCodeEnd":94,"githubUrl":"https://github.com/go-task/task/blob/385e5ad92af02877b6d7cf9dcc963b5ed916e70a/taskfile/ast/platforms.go#L58-L94","documentation":"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.","triggerScenarios":"A task's `platforms:` array contains an empty string element (e.g. a stray `- ` line or `- ''`) — parsePlatform calls parseOsOrArch with \"\" and fails.","commonSituations":"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.","solutions":["Remove the empty entry from the platforms list","Fill in a valid value like `linux`, `darwin`, `windows`, `amd64`, or a combined `os/arch` form (e.g. `linux/amd64`)","Inspect the raw YAML for dangling `- ` lines or unexpanded template variables"],"exampleFix":"# before\nplatforms:\n  - linux\n  -\n# after\nplatforms:\n  - linux\n  - darwin","handlingStrategy":"validation","validationCode":"for i, p := range taskDef.Platforms {\n  if strings.TrimSpace(p) == \"\" {\n    return fmt.Errorf(\"platforms[%d] is empty\", i)\n  }\n}","typeGuard":null,"tryCatchPattern":"err := t.Run(ctx)\nif err != nil && strings.Contains(err.Error(), \"Blank OS/Arch\") {\n  // clean the platforms list and reload the Taskfile\n}","preventionTips":["Never leave dangling `-` entries in YAML lists","If platforms come from templates, guard empty expansions (`{{ if var }}`)","Lint/parse the Taskfile YAML before running"],"tags":["taskfile","platforms","configuration"],"backgroundTag":"blank-required-value","analyzedSha":"385e5ad92af02877b6d7cf9dcc963b5ed916e70a","analyzedAt":"2026-09-05T09:01:05.226Z","contentChangedAt":"2026-09-05T09:01:05.226Z","schemaVersion":2},"datasetVersion":"2026-09-12T12:17:11.808Z"}