golang/go · error

no %sprotocol found for repository

Error message

no %sprotocol found for repository

What it means

For schemeless repository URLs (typically from vanity import paths), the go tool iterates each transport scheme the VCS supports (https, http, git, ssh), filtered by the requested security level. If no scheme responds successfully to a PingCmd probe (or the VCS has no PingCmd and none of the schemes succeed downstream), this error is returned.

Source

Thrown at src/cmd/go/internal/vcs/vcs.go:905

							continue
						}

						// If we know how to ping URL schemes for this VCS,
						// check that this repo works.
						// Otherwise, default to the first scheme
						// that meets the requested security level.
						if vcs.PingCmd == "" {
							return s, nil
						}
						if err := vcs.Ping(s, repo); err == nil {
							return s, nil
						}
					}
					securityFrag := ""
					if security == web.SecureOnly {
						securityFrag = "secure "
					}
					return "", fmt.Errorf("no %sprotocol found for repository", securityFrag)
				}()
				if err != nil {
					return nil, err
				}
				repoURL = scheme + "://" + repo
			}
		}
		rr := &RepoRoot{
			Repo: repoURL,
			Root: match["root"],
			VCS:  vcs,
		}
		return rr, nil
	}
	return nil, errUnknownSite
}

func interceptVCSTest(repo string, vcs *Cmd, security web.SecurityMode) (repoURL string, ok bool) {

View on GitHub (pinned to b6b368adc5)

Solutions

  1. Test connectivity: `curl -v https://<repo-host>` and `git ls-remote <repo-url>`
  2. Check the go-import meta tag for the correct repository URL
  3. If behind a corporate proxy, ensure HTTPS and git protocols are allowed
  4. Try GOINSECURE if the issue is a self-signed certificate (development only)
  5. Use a replace directive to point at a working mirror

Example fix

# before: repository unreachable over all protocols
go get example.com/pkg

# after: diagnose with git directly
git ls-remote https://github.com/me/pkg
# then fix the vanity meta tag or use replace:
# go.mod: replace example.com/pkg => github.com/me/pkg v1.0.0
Defensive patterns

Strategy: retry

Validate before calling

# Pre-check repository reachability before go get
REPO_URL=$(curl -sL "https://$IMPORT_PATH?go-get=1" | grep -oP 'go-import" content="[^"]+"' | awk '{print $4}' | tr -d '"')
if [ -n "$REPO_URL" ]; then
  if ! git ls-remote "$REPO_URL" >/dev/null 2>&1; then
    echo "WARNING: repository unreachable: $REPO_URL"
  fi
fi

Try / catch

# Retry with GOINSECURE or suggest network diagnostics
ERR=$(go get $IMPORT_PATH 2>&1)
if echo "$ERR" | grep -q 'no .*protocol found for repository'; then
  echo 'Repository unreachable over all protocols.'
  echo 'Check: network, DNS, firewall, and the go-import meta tag URL.'
  echo 'Retry with GOINSECURE for self-signed certs (dev only):'
  echo '  GOINSECURE=* go get $IMPORT_PATH'
fi

Prevention

When it happens

Trigger: A vanity import path resolves to a repository that is unreachable over all supported transport protocols — wrong hostname, dead server, firewall blocking https/git/ssh, or a repository that has moved.

Common situations: Dead or moved repository URL; typo in the vanity path's go-import meta tag; firewall/proxy blocking git:// or ssh:// protocols; server temporarily down; HTTPS certificate issues causing ping failures.

Related errors


AI-assisted analysis of golang/go@b6b368adc5 (2026-08-12). Data as JSON: /api/errors/5db3364b9d48cd32. Report an issue: GitHub.