argoproj/argo-workflows · error

failed to get work tree: %w

Error message

failed to get work tree: %w

What it means

git artifact Load could not obtain the git work tree (r.Worktree()) after clone/fetch, so checkout/submodule steps cannot proceed. Usually indicates repository corruption on disk or an unexpected repo state.

Source

Thrown at workflow/artifacts/git/git.go:169

	} else if err != nil {
		return fmt.Errorf("failed to clone %q: %w", a.Repo, err)
	}
	if len(a.Fetch) > 0 {
		refSpecs := make([]config.RefSpec, len(a.Fetch))
		for i, spec := range a.Fetch {
			refSpecs[i] = config.RefSpec(spec)
		}
		opts := &git.FetchOptions{Auth: auth, RefSpecs: refSpecs, Depth: depth, InsecureSkipTLS: g.InsecureSkipTLS}
		if validateErr := opts.Validate(); validateErr != nil {
			return fmt.Errorf("failed to validate fetch %v: %w", refSpecs, validateErr)
		}
		if err = r.Fetch(opts); isFetchErr(err) {
			return fmt.Errorf("failed to fetch %v: %w", refSpecs, err)
		}
	}
	w, err := r.Worktree()
	if err != nil {
		return fmt.Errorf("failed to get work tree: %w", err)
	}

	if a.Revision != "" {
		refSpecs := []config.RefSpec{"refs/heads/*:refs/heads/*"}
		if a.SingleBranch {
			refSpecs = []config.RefSpec{config.RefSpec(fmt.Sprintf("refs/heads/%s:refs/heads/%s", a.Branch, a.Branch))}
		}
		opts := &git.FetchOptions{Auth: auth, RefSpecs: refSpecs, InsecureSkipTLS: g.InsecureSkipTLS}
		if err := opts.Validate(); err != nil {
			return fmt.Errorf("failed to validate fetch %v: %w", refSpecs, err)
		}
		if err := r.Fetch(opts); isFetchErr(err) {
			return fmt.Errorf("failed to fetch %v: %w", refSpecs, err)
		}
		h, err := r.ResolveRevision(plumbing.Revision(a.Revision))
		if err != nil {
			return fmt.Errorf("failed to get resolve revision: %w", err)
		}

View on GitHub (pinned to 35bff19146)

Solutions

  1. Clear any cached git directory for this artifact and retry
  2. Check disk space and write permissions in the artifact staging directory
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at workflow/artifacts/git/git.go:169 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/bb5974b67e0a8d80. Report an issue: GitHub.