argoproj/argo-workflows · error
failed to unmarshal YAML %q: %w
Error message
failed to unmarshal YAML %q: %w
What it means
MustUnmarshal fell through to YAML parsing (input not '@' or '{') and yaml.UnmarshalStrict rejected the document — strict mode fails on unknown or duplicate fields. The panic message embeds the offending text.
Source
Thrown at pkg/apis/workflow/v1alpha1/marshall.go:37
case []byte:
if len(x) == 0 {
panic("no text to unmarshal")
}
switch x[0] {
case '@':
filename := string(x[1:])
y, err := os.ReadFile(filepath.Clean(filename))
if err != nil {
panic(fmt.Errorf("failed to read file %s: %w", filename, err))
}
MustUnmarshal(y, v)
case '{':
if err := json.Unmarshal(x, v); err != nil {
panic(fmt.Errorf("failed to unmarshal JSON %q: %w", string(x), err))
}
default:
if err := yaml.UnmarshalStrict(x, v); err != nil {
panic(fmt.Errorf("failed to unmarshal YAML %q: %w", string(x), err))
}
}
default:
panic(fmt.Errorf("cannot unmarshal type %T", text))
}
}
func MustMarshallJSON(v any) string {
data, err := json.Marshal(v)
if err != nil {
panic(err)
}
return string(data)
}
func MustUnmarshalClusterWorkflowTemplate(text any) *ClusterWorkflowTemplate {
x := &ClusterWorkflowTemplate{}
MustUnmarshal(text, &x)View on GitHub (pinned to 35bff19146)
Solutions
- Remove unknown/mistyped fields from the YAML
- Check for duplicate keys, which strict unmarshalling rejects
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at pkg/apis/workflow/v1alpha1/marshall.go:37 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of argoproj/argo-workflows@35bff19146 (2026-09-03).
Data as JSON: /api/errors/6e5485fdec0b9ba8.
Report an issue: GitHub.