argoproj/argo-workflows · error
failed to convert to workflow from unstructured: %w
Error message
failed to convert to workflow from unstructured: %w
What it means
In archiveWorkflowAux (workflow/controller/controller.go:1397), the completed-workflow archiving path converts the unstructured informer object into a typed *wfv1.Workflow via util.FromUnstructured; if the conversion (including spec validation) fails, this wrapped error is returned. It means the object that just completed does not deserialize/validate as a valid Workflow.
Source
Thrown at workflow/controller/controller.go:1397
if wf != nil {
wfc.metrics.DeleteRealtimeMetricsForWfUID(string(wf.GetUID()))
}
},
})
if err != nil {
return err
}
return nil
}
func (wfc *WorkflowController) archiveWorkflowAux(ctx context.Context, obj any) error {
un, ok := obj.(*unstructured.Unstructured)
if !ok {
return nil
}
wf, err := util.FromUnstructured(un)
if err != nil {
return fmt.Errorf("failed to convert to workflow from unstructured: %w", err)
}
err = wfc.hydrator.Hydrate(ctx, wf)
if err != nil {
return fmt.Errorf("failed to hydrate workflow: %w", err)
}
logger := logging.RequireLoggerFromContext(ctx)
logger.WithFields(logging.Fields{"namespace": wf.Namespace, "workflow": wf.Name, "uid": wf.UID}).Info(ctx, "archiving workflow")
err = wfc.wfArchive.ArchiveWorkflow(ctx, wf)
if err != nil {
return fmt.Errorf("failed to archive workflow: %w", err)
}
data, err := json.Marshal(map[string]any{
"metadata": metav1.ObjectMeta{
Labels: map[string]string{
common.LabelKeyWorkflowArchivingStatus: "Archived",
},
},
})View on GitHub (pinned to 35bff19146)
Solutions
- Check the wrapped inner error for the exact schema/validation failure and fix the offending workflow fields.
- Align controller and CRD versions (upgrade both together); re-apply the matching CRDs from the same release.
- Delete/recreate the malformed workflow if its content is unrecoverable; archiving is skipped but the workflow is not blocked from deletion.
- Run `argo lint` on the workflow spec to reproduce the validation error outside the controller.
Defensive patterns
Strategy: validation
Validate before calling
// Validate the workflow spec before submitting so completion-time conversion can't fail
wf := wfv1.Workflow{}
if err := json.Unmarshal(raw, &wf); err != nil { return err }
if err := wf.Validate(ctx, validate.DefaultOpts); err != nil { return err }
// or: argo lint my-workflow.yaml Try / catch
wf, err := util.FromUnstructured(un)
if err != nil {
return fmt.Errorf("failed to convert to workflow from unstructured: %w", err)
} Prevention
- Keep controller and CRD versions in lockstep (re-apply CRDs on every upgrade)
- Never hand-edit Workflow CRs; submit via `argo submit` or validated manifests
- Run `argo lint` on workflow definitions before submitting
- Test cross-version upgrades in staging to catch schema skew
When it happens
Trigger: A workflow object on workflow-completion (added to the archive queue) cannot be converted from unstructured — corrupted or non-conforming Workflow CR in the cluster, an object written by an incompatible/newer schema version, or a malformed CR applied manually.
Common situations: CRD/schema version skew (controller older than objects written by a newer Argo version); hand-edited workflow resources; validation rules tightened in util.FromUnstructured so legacy objects no longer pass.
Understand the failure class
Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.
Related errors
- executor plugin metadata name is mandatory
- clientSecret empty
- ConfigMap '%s' needs to have the label %s: %s to load parame
- ArtifactGCStrategy %q not valid
- failed to mark the workflow archived: %w
AI-assisted analysis of argoproj/argo-workflows@35bff19146 (2026-09-03).
Data as JSON: /api/errors/df2da10141846634.
Report an issue: GitHub.