argoproj/argo-workflows · error

failed to fetch %v: %w

Error message

failed to fetch %v: %w

What it means

During git artifact Load, the explicit fetch (a.Fetch refspecs) failed with an error other than 'already up-to-date' — bad refspec, missing ref on the remote, or auth failure. The refspecs are included in the message.

Source

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

		}
		if err = r.CreateBranch(&config.Branch{Name: branchName, Remote: git.DefaultRemoteName, Merge: plumbing.Master}); err != nil {
			return fmt.Errorf("failed to create branch %q: %w", branchName, err)
		}
		return nil
	} 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)

View on GitHub (pinned to 35bff19146)

Solutions

  1. Check that the fetch refspecs reference branches/tags that exist on the remote
  2. Verify repo credentials (SSH key/username+password) are correct
Defensive patterns

Strategy: try-catch

When it happens

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