golang/go · error
empty entry in GOVCS
Error message
empty entry in GOVCS
What it means
The GOVCS environment variable is a comma-separated list of 'pattern:vcsList' rules. During parsing, each comma-separated entry is trimmed; if an entry is empty (from a trailing comma, leading comma, or double comma), it is rejected as invalid.
Source
Thrown at src/cmd/go/internal/vcs/vcs.go:638
type govcsRule struct {
pattern string
allowed []string
}
// A govcsConfig is a full GOVCS configuration.
type govcsConfig []govcsRule
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)
}View on GitHub (pinned to b6b368adc5)
Solutions
- Inspect the full GOVCS value: `echo $GOVCS`
- Remove stray/empty entries — every comma-separated item must be non-empty
- Validate the GOVCS string before setting it (see validationCode)
Example fix
# before export GOVCS="public:git,,private:all" # after export GOVCS="public:git,private:all"
Defensive patterns
Strategy: validation
Validate before calling
# Validate GOVCS for empty entries before running go commands
GOVCS_VAL="${GOVCS:-}"
if [ -n "$GOVCS_VAL" ]; then
echo "$GOVCS_VAL" | tr ',' '\n' | while IFS= read -r entry; do
entry="$(echo "$entry" | xargs)" # trim
if [ -z "$entry" ]; then
echo "ERROR: empty entry in GOVCS (check for stray/double/trailing commas)"
fi
done
fi Prevention
- Always validate GOVCS in CI before running go commands
- Avoid dynamically constructing GOVCS strings that may leave empty entries
- Test GOVCS changes with `go env GOVCS` and a trial `go get`
When it happens
Trigger: GOVCS contains a stray comma: `GOVCS=public:git,,private:all` (double comma) or `GOVCS=public:git,` (trailing comma) or `GOVCS=,public:git` (leading comma).
Common situations: Shell variable construction with empty elements; copy-paste errors in GOVCS; CI config templating that leaves trailing commas.
Related errors
- 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
- unreachable pattern in GOVCS: %q after %q
AI-assisted analysis of golang/go@b6b368adc5 (2026-08-12).
Data as JSON: /api/errors/c73c5aa2290ef750.
Report an issue: GitHub.