From 462ab01a3e7ad2a92f2c017f6856b60ca117b666 Mon Sep 17 00:00:00 2001 From: Sebastian Rath Date: Tue, 17 Feb 2026 00:16:08 -0500 Subject: [PATCH] Fix ghost error in validation function when group node has issues --- core/base.go | 12 +++++++++--- nodes/group@v1.go | 7 +++++-- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/core/base.go b/core/base.go index df52d40..a0cd38a 100644 --- a/core/base.go +++ b/core/base.go @@ -618,8 +618,14 @@ func NewNodeInstance(nodeType string, parent NodeBaseInterface, parentId string, // Pass 'validate' to the factory function node, errs = factoryEntry.FactoryFn(nil, parent, parentId, nodeDef, validate, opts) if len(errs) > 0 { - // If the factory failed to produce a node (or found errors), return them. - return nil, errs + if node == nil || !validate { + // factory failed to produce a node, or we're not in validation mode. + return nil, errs + } + // factory produced a valid node but found validation errors (eg group + // with sub-graph errors). We continue here so the parent graph + // at least can continue to register the node and report. All the + // validation errors are returned anyway, so nothing is lost. } } else { return nil, []error{CreateErr(nil, nil, "unknown node type '%v'", nodeType)} @@ -658,7 +664,7 @@ func NewNodeInstance(nodeType string, parent NodeBaseInterface, parentId string, node.SetNodeType(nodeType) node.SetName(factoryEntry.Name) node.SetParent(parent) - return node, nil + return node, errs } func GlobFilter(path string, pattern []string) (bool, error) { diff --git a/nodes/group@v1.go b/nodes/group@v1.go index 1419a59..73d9d02 100644 --- a/nodes/group@v1.go +++ b/nodes/group@v1.go @@ -291,8 +291,11 @@ func init() { } } - if len(collectedErrors) > 0 { - return nil, collectedErrors + if len(collectedErrors) > 0 && !validate { + // Return the collected errors instead of nil to prevent cascading + // validation errors where the group node is never registered in the + // parent graph, causing some ghost errors about missing nodes + return group, collectedErrors } return group, nil