goharbor/harbor · error

failed to walk manifest

Error message

failed to walk manifest: %w

What it means

Wrapping error in the CNAI files parser Parse: walkManifest failed while converting the OCI manifest's layers into a file tree. The %w is usually a path-conflict or invalid-path error from AddNode, so the file listing cannot be produced.

Solutions

  1. Inspect the wrapped error to find the conflicting or invalid path in manifest layers.
  2. Fix duplicate paths where the same name appears as both file and directory.
  3. Validate layer filepath annotations before pushing the model artifact.
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at src/controller/artifact/processor/cnai/parser/files.go:57 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/630bef4c3687c2cc. Report an issue: GitHub.

Appendix: source

Thrown at src/controller/artifact/processor/cnai/parser/files.go:57

	*base
}

type FileList struct {
	Name     string     `json:"name"`
	Type     string     `json:"type"`
	Size     int64      `json:"size,omitempty"`
	Children []FileList `json:"children,omitempty"`
}

// Parse parses the files list.
func (f *files) Parse(_ context.Context, _ *artifact.Artifact, manifest *ocispec.Manifest) (string, []byte, error) {
	if manifest == nil {
		return "", nil, fmt.Errorf("manifest cannot be nil")
	}

	rootNode, err := walkManifest(*manifest)
	if err != nil {
		return "", nil, fmt.Errorf("failed to walk manifest: %w", err)
	}

	fileLists := traverseFileNode(rootNode)
	data, err := json.Marshal(fileLists)
	if err != nil {
		return "", nil, err
	}

	return contentTypeJSON, data, nil
}

// walkManifest walks the manifest and returns the root file node.
func walkManifest(manifest ocispec.Manifest) (*FileNode, error) {
	root := NewDirectory("/")
	for _, layer := range manifest.Layers {
		if layer.Annotations != nil && layer.Annotations[modelspec.AnnotationFilepath] != "" {
			filepath := layer.Annotations[modelspec.AnnotationFilepath]
			// mark it to directory if the file path ends with "/".

View on GitHub (pinned to 7b2fd08cc5)