golang/go · error

GOVCS disallows using %s for %s %s; see 'go help vcs'

Error message

GOVCS disallows using %s for %s %s; see 'go help vcs'

What it means

checkGOVCS applies the parsed GOVCS rules (user-provided GOVCS plus built-in defaults) to a specific VCS/path combination. The built-in defaults allow only git and hg for public repositories, and all VCS types for private (GOPRIVATE-matched) repositories. If no rule permits the combination, the operation is blocked for security.

Source

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

		// and are always allowed.
		return nil
	}

	govcsOnce.Do(func() {
		govcs, govcsErr = parseGOVCS(os.Getenv("GOVCS"))
		govcs = append(govcs, defaultGOVCS...)
	})
	if govcsErr != nil {
		return govcsErr
	}

	private := module.MatchPrefixPatterns(cfg.GOPRIVATE, root)
	if !govcs.allow(root, private, vcs.Cmd) {
		what := "public"
		if private {
			what = "private"
		}
		return fmt.Errorf("GOVCS disallows using %s for %s %s; see 'go help vcs'", vcs.Cmd, what, root)
	}

	return nil
}

// RepoRoot describes the repository root for a tree of source code.
type RepoRoot struct {
	Repo     string // repository URL, including scheme
	Root     string // import path corresponding to the SubDir
	SubDir   string // subdirectory within the repo (empty for root)
	IsCustom bool   // defined by served <meta> tags (as opposed to hard-coded pattern)
	VCS      *Cmd
}

func httpPrefix(s string) string {
	for _, prefix := range [...]string{"http:", "https:"} {
		if strings.HasPrefix(s, prefix) {
			return prefix

View on GitHub (pinned to b6b368adc5)

Solutions

  1. Add an explicit GOVCS rule for the path: `GOVCS=example.com:fossil,public:git|hg`
  2. If the module is actually private, add its prefix to GOPRIVATE so the 'private: all' default applies
  3. Run `go help vcs` to understand the GOVCS format and defaults
  4. For broad access, set `GOVCS=*:all` (reduces security — understand the risk)

Example fix

# before: public Fossil repo blocked by default GOVCS
export GOPRIVATE=''
go get example.com/fossil-repo  # GOVCS disallows using fossil for public

# after: add explicit GOVCS rule
export GOVCS="example.com:fossil"
go get example.com/fossil-repo

# or mark the path as private (if applicable)
export GOPRIVATE="example.com"
go get example.com/fossil-repo
Defensive patterns

Strategy: validation

Validate before calling

# Check whether the needed VCS is allowed by current GOVCS settings
# List current GOVCS and defaults
GOVCS_VAL="${GOVCS:-}"
echo "Current GOVCS: ${GOVCS_VAL:-<unset — defaults: public:git|hg, private:all>}"
echo "GOPRIVATE: ${GOPRIVATE:-<unset>}"
echo "If fetching a public SVN/Fossil/Bazaar repo, add an explicit GOVCS rule."
echo "Example: GOVCS=example.com:fossil"

Try / catch

# Detect GOVCS denial and provide actionable guidance
ERR=$(go get $IMPORT_PATH 2>&1)
if echo "$ERR" | grep -q 'GOVCS disallows'; then
  echo 'Blocked by GOVCS policy. Options:'
  echo '  1. Add GOVCS rule: export GOVCS="<domain>:<vcs>,public:git|hg"'
  echo '  2. Add to GOPRIVATE if the module is private: export GOPRIVATE="<domain>"'
  echo '  See: go help vcs'
fi

Prevention

When it happens

Trigger: `go get` of a public module hosted on SVN, Fossil, or Bazaar (disallowed by default GOVCS); or a custom restrictive GOVCS that excludes the VCS needed for a particular path.

Common situations: Fetching a public Fossil/Bazaar/SVN repo without configuring GOVCS; restrictive corporate GOVCS policy; GOPRIVATE not set for a private repo that uses a non-git/hg VCS.

Related errors


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