golang/go · error

unrecognized VCS tool output

Error message

unrecognized VCS tool output

What it means

parseRevTime expects VCS info output shaped `revision:seconds`. It fails if there is no colon at index >= 1, or if the substring after the colon is not a base-10 integer (in which case it wraps the strconv error with the same message). This affects non-git VCS tools (hg, svn, fossil) whose log/info output is parsed this way.

Source

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

	if err != nil {
		return Status{}, err
	}
	uncommitted := len(out) > 0

	return Status{
		Revision:    rev,
		CommitTime:  commitTime,
		Uncommitted: uncommitted,
	}, nil
}

// parseRevTime parses commit details in "revision:seconds" format.
func parseRevTime(out []byte) (string, time.Time, error) {
	buf := string(bytes.TrimSpace(out))

	i := strings.IndexByte(buf, ':')
	if i < 1 {
		return "", time.Time{}, errors.New("unrecognized VCS tool output")
	}
	rev := buf[:i]

	secs, err := strconv.ParseInt(buf[i+1:], 10, 64)
	if err != nil {
		return "", time.Time{}, fmt.Errorf("unrecognized VCS tool output: %v", err)
	}

	return rev, time.Unix(secs, 0), nil
}

// vcsGit describes how to use Git.
var vcsGit = &Cmd{
	Name: "Git",
	Cmd:  "git",
	Roots: []isVCSRoot{
		vcsGitRoot{},
	},

View on GitHub (pinned to b6b368adc5)

Solutions

  1. Upgrade the VCS tool to a version the go command supports.
  2. Force the C locale (LC_ALL=C) so output formatting matches expectations.
  3. Verify repository integrity (e.g. hg/svn checkout is valid).
  4. Prefer a git-backed module if you control the source.

Example fix

# before
$ LC_ALL=de_DE.UTF-8 go get -v example.com/lib  # localized hg output

# after
$ LC_ALL=C go get -v example.com/lib
Defensive patterns

Strategy: validation

Validate before calling

// Verify the VCS tool and locale before fetching non-git modules.
func vcsEnvOK() error {
    if _, err := exec.LookPath("hg"); err == nil { // example for hg
        if os.Getenv("LC_ALL") != "C" {
            return errors.New("set LC_ALL=C for deterministic VCS output")
        }
    }
    return nil
}

Type guard

null

Try / catch

null

Prevention

When it happens

Trigger: A VCS command returns output that doesn't match the `revision:seconds` contract — e.g. due to an unsupported/old VCS version, localized output, or a corrupt repository.

Common situations: Old Mercurial/Subversion/Fossil versions; non-C locale altering output formatting; damaged checkouts.

Related errors


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