XTLS/Xray-core · warning

Command "%s" not found. Make sure that %s is in your system

Error message

Command "%s" not found.
Make sure that %s is in your system path or current path.
Download %s v%s or later from https://github.com/protocolbuffers/protobuf/releases

What it means

vprotogen (the repo's codegen helper under infra/vprotogen) shells out to protoc and locates it with exec.LookPath. This error means the protoc binary (with the given suffix) was not found on PATH, GOBIN, or GOPATH/bin, and tells you the minimum version to install from the protobuf releases page.

Source

Thrown at infra/vprotogen/main.go:92

		GOBIN, err = GetRuntimeEnv("GOBIN")
		if err != nil {
			// The default one that Golang uses
			return filepath.Join(build.Default.GOPATH, "bin")
		}
		if GOBIN == "" {
			return filepath.Join(build.Default.GOPATH, "bin")
		}
		return GOBIN
	}
	return GOBIN
}

func whichProtoc(suffix, targetedVersion string) (string, error) {
	protoc := "protoc" + suffix

	path, err := exec.LookPath(protoc)
	if err != nil {
		return "", fmt.Errorf(`
Command "%s" not found.
Make sure that %s is in your system path or current path.
Download %s v%s or later from https://github.com/protocolbuffers/protobuf/releases
`, protoc, protoc, protoc, targetedVersion)
	}
	return path, nil
}

func getProjectProtocVersion(url string) (string, error) {
	resp, err := http.Get(url)
	if err != nil {
		return "", errors.New("can not get the version of protobuf used in xray project")
	}
	defer resp.Body.Close()
	body, err := io.ReadAll(resp.Body)
	if err != nil {
		return "", errors.New("can not read from body")
	}

View on GitHub (pinned to 7d214f8b09)

Solutions

  1. Install protoc >= the version named in the message from https://github.com/protocolbuffers/protobuf/releases
  2. Ensure the binary's directory is on PATH (verify with `protoc --version`)
  3. Alternatively skip codegen: normal `go build ./...` does not require protoc — only regenerating .pb.go files does

Example fix

# before: protoc: command not found → error 835
# after
brew install protobuf   # or: apt install -y protobuf-compiler
protoc --version && go run ./infra/vprotogen
Defensive patterns

Strategy: validation

Validate before calling

import "os/exec"

func protocAvailable() bool {
    _, err := exec.LookPath("protoc")
    return err == nil
}
// gate codegen targets on protocAvailable(); plain builds need no protoc

Prevention

When it happens

Trigger: Running `go run ./infra/vprotogen` (usually via `go generate ./...` or the repo's regenerate target) on a machine without protoc installed, or where protoc is installed but its directory is not in PATH.

Common situations: Fresh clone building Xray-core for the first time; CI images without protobuf; protoc installed via brew/apt into a non-PATH dir; Windows needing protoc.exe.

Related errors


AI-assisted analysis of XTLS/Xray-core@7d214f8b09 (2026-08-15). Data as JSON: /api/errors/e6bc8c55f96ae1c2. Report an issue: GitHub.