argoproj/argo-workflows · error

failed to checkout %q: %w

Error message

failed to checkout %q: %w

What it means

After resolving the revision to a hash, git checkout of that commit failed in the work tree — typically dirty state, deleted paths, or an invalid hash. This is the final step of pinning the artifact repo to the requested revision.

Source

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

	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)
		}
		if err := w.Checkout(&git.CheckoutOptions{Hash: plumbing.NewHash(h.String())}); err != nil {
			return fmt.Errorf("failed to checkout %q: %w", h, err)
		}
	}
	if !a.DisableSubmodules {
		s, err := w.Submodules()
		if err != nil {
			return fmt.Errorf("failed to get submodules: %w", err)
		}
		if err := s.Update(&git.SubmoduleUpdateOptions{
			Init:              true,
			RecurseSubmodules: git.DefaultSubmoduleRecursionDepth,
			Auth:              auth,
		}); err != nil {
			return fmt.Errorf("failed to update submodules: %w", err)
		}
	}
	return nil
}

View on GitHub (pinned to 35bff19146)

Solutions

  1. Ensure the revision resolves to a valid commit reachable in the clone
  2. Retry after clearing the artifact git cache
Defensive patterns

Strategy: retry

When it happens

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