golang/go · error

empty VCS list in GOVCS: %q

Error message

empty VCS list in GOVCS: %q

What it means

After splitting a GOVCS entry on ':', the VCS list portion (right of the colon) is empty after trimming — e.g., `public:` or `public: `.

Source

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

		return nil, nil
	}
	var cfg govcsConfig
	have := make(map[string]string)
	for item := range strings.SplitSeq(s, ",") {
		item = strings.TrimSpace(item)
		if item == "" {
			return nil, fmt.Errorf("empty entry in GOVCS")
		}
		pattern, list, found := strings.Cut(item, ":")
		if !found {
			return nil, fmt.Errorf("malformed entry in GOVCS (missing colon): %q", item)
		}
		pattern, list = strings.TrimSpace(pattern), strings.TrimSpace(list)
		if pattern == "" {
			return nil, fmt.Errorf("empty pattern in GOVCS: %q", item)
		}
		if list == "" {
			return nil, fmt.Errorf("empty VCS list in GOVCS: %q", item)
		}
		if search.IsRelativePath(pattern) {
			return nil, fmt.Errorf("relative pattern not allowed in GOVCS: %q", pattern)
		}
		if old := have[pattern]; old != "" {
			return nil, fmt.Errorf("unreachable pattern in GOVCS: %q after %q", item, old)
		}
		have[pattern] = item
		allowed := strings.Split(list, "|")
		for i, a := range allowed {
			a = strings.TrimSpace(a)
			if a == "" {
				return nil, fmt.Errorf("empty VCS name in GOVCS: %q", item)
			}
			allowed[i] = a
		}
		cfg = append(cfg, govcsRule{pattern, allowed})
	}

View on GitHub (pinned to b6b368adc5)

Solutions

  1. Ensure every entry has a non-empty VCS list after the colon
  2. Valid lists use VCS names separated by '|', e.g., `git|hg`
  3. Inspect each entry: every item must look like `pattern:nonemptyvcslist`

Example fix

# before
export GOVCS="public:"

# after
export GOVCS="public:git|hg"
Defensive patterns

Strategy: validation

Validate before calling

# Validate GOVCS entries have non-empty VCS lists
GOVCS_VAL="${GOVCS:-}"
if [ -n "$GOVCS_VAL" ]; then
  echo "$GOVCS_VAL" | tr ',' '\n' | while IFS= read -r entry; do
    entry="$(echo "$entry" | xargs)"
    vcslist="${entry#*:}"
    vcslist="$(echo "$vcslist" | xargs)"
    if [ -n "$entry" ] && echo "$entry" | grep -q ':' && [ -z "$vcslist" ]; then
      echo "ERROR: empty VCS list in GOVCS entry: $entry"
    fi
  done
fi

Prevention

When it happens

Trigger: GOVCS entry with no VCS list after the colon: `GOVCS=public:,private:all` or `GOVCS=github.com:`.

Common situations: Typo leaving the list blank; incomplete editing of the GOVCS string.

Related errors


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