{"record":{"id":"a9d1bf7e708ff00e","repo":"golang/go","slug":"empty-vcs-name-in-govcs-q","errorCode":null,"errorMessage":"empty VCS name in GOVCS: %q","messagePattern":"empty VCS name in GOVCS: %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cmd/go/internal/vcs/vcs.go","lineNumber":662,"sourceCode":"\t\tpattern, list = strings.TrimSpace(pattern), strings.TrimSpace(list)\n\t\tif pattern == \"\" {\n\t\t\treturn nil, fmt.Errorf(\"empty pattern in GOVCS: %q\", item)\n\t\t}\n\t\tif list == \"\" {\n\t\t\treturn nil, fmt.Errorf(\"empty VCS list in GOVCS: %q\", item)\n\t\t}\n\t\tif search.IsRelativePath(pattern) {\n\t\t\treturn nil, fmt.Errorf(\"relative pattern not allowed in GOVCS: %q\", pattern)\n\t\t}\n\t\tif old := have[pattern]; old != \"\" {\n\t\t\treturn nil, fmt.Errorf(\"unreachable pattern in GOVCS: %q after %q\", item, old)\n\t\t}\n\t\thave[pattern] = item\n\t\tallowed := strings.Split(list, \"|\")\n\t\tfor i, a := range allowed {\n\t\t\ta = strings.TrimSpace(a)\n\t\t\tif a == \"\" {\n\t\t\t\treturn nil, fmt.Errorf(\"empty VCS name in GOVCS: %q\", item)\n\t\t\t}\n\t\t\tallowed[i] = a\n\t\t}\n\t\tcfg = append(cfg, govcsRule{pattern, allowed})\n\t}\n\treturn cfg, nil\n}\n\nfunc (c *govcsConfig) allow(path string, private bool, vcs string) bool {\n\tfor _, rule := range *c {\n\t\tmatch := false\n\t\tswitch rule.pattern {\n\t\tcase \"private\":\n\t\t\tmatch = private\n\t\tcase \"public\":\n\t\t\tmatch = !private\n\t\tdefault:\n\t\t\t// Note: rule.pattern is known to be comma-free,","sourceCodeStart":644,"sourceCodeEnd":680,"githubUrl":"https://github.com/golang/go/blob/b6b368adc57c96c3151d224d172029f233ead2c3/src/cmd/go/internal/vcs/vcs.go#L644-L680","documentation":"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.","triggerScenarios":"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).","commonSituations":"Shell variable construction leaving stray pipes; copy-paste errors; incomplete editing of a VCS list.","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"],"exampleFix":"# before: trailing pipe creates empty VCS name\nexport GOVCS=\"public:git|\"\n\n# after\nexport GOVCS=\"public:git\"","handlingStrategy":"validation","validationCode":"# Validate GOVCS VCS lists have no empty names (stray pipes)\nGOVCS_VAL=\"${GOVCS:-}\"\nif [ -n \"$GOVCS_VAL\" ]; then\n  echo \"$GOVCS_VAL\" | tr ',' '\\n' | while IFS= read -r entry; do\n    entry=\"$(echo \"$entry\" | xargs)\"\n    vcslist=\"${entry#*:}\"\n    echo \"$vcslist\" | tr '|' '\\n' | while IFS= read -r vcs; do\n      vcs=\"$(echo \"$vcs\" | xargs)\"\n      if [ -z \"$vcs\" ]; then\n        echo \"ERROR: empty VCS name in GOVCS entry: $entry (check for stray pipes)\"\n      fi\n    done\n  done\nfi","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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"],"tags":["vcs","config","govcs","validation"],"backgroundTag":null,"analyzedSha":"b6b368adc57c96c3151d224d172029f233ead2c3","analyzedAt":"2026-08-12T00:22:02.250Z","schemaVersion":2},"datasetVersion":"2026-08-12T12:31:55.035Z"}