golang/go · error
empty VCS name in GOVCS: %q
Error message
empty VCS name in GOVCS: %q
What it means
Within a GOVCS VCS list (the part after the colon, split by '|'), each individual VCS name must be non-empty. If splitting on '|' yields an empty element (e.g., trailing pipe, double pipe), the entry is rejected.
Source
Thrown at src/cmd/go/internal/vcs/vcs.go:662
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})
}
return cfg, nil
}
func (c *govcsConfig) allow(path string, private bool, vcs string) bool {
for _, rule := range *c {
match := false
switch rule.pattern {
case "private":
match = private
case "public":
match = !private
default:
// Note: rule.pattern is known to be comma-free,View on GitHub (pinned to b6b368adc5)
Solutions
- Ensure every pipe-separated VCS name is non-empty
- Format: `pattern:git|hg|fossil` with no trailing or doubled pipes
- Inspect the full GOVCS value for stray pipe characters
Example fix
# before: trailing pipe creates empty VCS name export GOVCS="public:git|" # after export GOVCS="public:git"
Defensive patterns
Strategy: validation
Validate before calling
# Validate GOVCS VCS lists have no empty names (stray pipes)
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#*:}"
echo "$vcslist" | tr '|' '\n' | while IFS= read -r vcs; do
vcs="$(echo "$vcs" | xargs)"
if [ -z "$vcs" ]; then
echo "ERROR: empty VCS name in GOVCS entry: $entry (check for stray pipes)"
fi
done
done
fi Prevention
- Ensure no trailing, leading, or doubled pipe characters in GOVCS VCS lists
- Format: pattern:git|hg|fossil (no empty segments)
- Validate GOVCS configuration in CI before running go commands
When it happens
Trigger: GOVCS VCS list contains an empty name: `GOVCS=public:git||hg` (double pipe) or `GOVCS=public:git|` (trailing pipe) or `GOVCS=public:|hg|` (leading/trailing pipe).
Common situations: Shell variable construction leaving stray pipes; copy-paste errors; incomplete editing of a VCS list.
Related errors
- empty entry in GOVCS
- malformed entry in GOVCS (missing colon): %q
- empty pattern in GOVCS: %q
- empty VCS list in GOVCS: %q
- relative pattern not allowed in GOVCS: %q
AI-assisted analysis of golang/go@b6b368adc5 (2026-08-12).
Data as JSON: /api/errors/a9d1bf7e708ff00e.
Report an issue: GitHub.