golang/go · error
empty pattern in GOVCS: %q
Error message
empty pattern in GOVCS: %q
What it means
After splitting a GOVCS entry on ':', the pattern portion (left of the colon) is empty after trimming whitespace — e.g., `:git` or ` :git`.
Source
Thrown at src/cmd/go/internal/vcs/vcs.go:646
func parseGOVCS(s string) (govcsConfig, error) {
s = strings.TrimSpace(s)
if s == "" {
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] = aView on GitHub (pinned to b6b368adc5)
Solutions
- Ensure every entry has a non-empty pattern before the colon
- Valid patterns are module path prefixes like 'github.com', 'example.com', 'public', 'private'
- Inspect each entry: every item must look like `nonemptypattern:vcslist`
Example fix
# before export GOVCS=":git" # after export GOVCS="public:git"
Defensive patterns
Strategy: validation
Validate before calling
# Validate GOVCS entries have non-empty patterns
GOVCS_VAL="${GOVCS:-}"
if [ -n "$GOVCS_VAL" ]; then
echo "$GOVCS_VAL" | tr ',' '\n' | while IFS= read -r entry; do
entry="$(echo "$entry" | xargs)"
pattern="${entry%%:*}"
pattern="$(echo "$pattern" | xargs)"
if [ -n "$entry" ] && echo "$entry" | grep -q ':' && [ -z "$pattern" ]; then
echo "ERROR: empty pattern in GOVCS entry: $entry"
fi
done
fi Prevention
- Every GOVCS entry must have a non-empty pattern before the colon
- Use module-path-style patterns: github.com, example.com, public, private
- Validate GOVCS configuration in CI
When it happens
Trigger: GOVCS entry with no pattern before the colon: `GOVCS=:git,public:hg` or `GOVCS= :fossil`.
Common situations: Typo leaving pattern blank; shell variable expansion that yields an empty pattern.
Related errors
- empty entry in GOVCS
- malformed entry in GOVCS (missing colon): %q
- empty VCS list in GOVCS: %q
- relative pattern not allowed in GOVCS: %q
- unreachable pattern in GOVCS: %q after %q
AI-assisted analysis of golang/go@b6b368adc5 (2026-08-12).
Data as JSON: /api/errors/8c0a01888cb2709c.
Report an issue: GitHub.