goharbor/harbor · error
cannot add child to non-directory node
Error message
cannot add child to non-directory node
What it means
Error "cannot add child to non-directory node" thrown in goharbor/harbor.
Source
Thrown at src/controller/artifact/processor/cnai/parser/util.go:141
Type: TypeFile,
Size: size,
}
}
func NewDirectory(name string) *FileNode {
return &FileNode{
Name: name,
Type: TypeDirectory,
Children: make(map[string]*FileNode),
}
}
func (root *FileNode) AddChild(child *FileNode) error {
root.mu.Lock()
defer root.mu.Unlock()
if root.Type != TypeDirectory {
return fmt.Errorf("cannot add child to non-directory node")
}
root.Children[child.Name] = child
return nil
}
func (root *FileNode) GetChild(name string) (*FileNode, bool) {
root.mu.RLock()
defer root.mu.RUnlock()
child, ok := root.Children[name]
return child, ok
}
func (root *FileNode) AddNode(path string, size int64, isDir bool) (*FileNode, error) {
path = filepath.Clean(path)
parts := strings.Split(path, string(filepath.Separator))
View on GitHub (pinned to 7b2fd08cc5)
When it happens
Trigger: Thrown at src/controller/artifact/processor/cnai/parser/util.go:141 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of goharbor/harbor@7b2fd08cc5 (2026-08-16).
Data as JSON: /api/errors/09874ead86291a6a.
Report an issue: GitHub.