hyperledger/fabric · error

unable to find sampleconfig directory on GOPATH

Error message

unable to find sampleconfig directory on GOPATH

What it means

gopathDevConfigDir scanned every GOPATH entry for src/github.com/hyperledger/fabric/sampleconfig and found none. This dev-only helper locates the in-tree sample configuration; absence means the source tree is not on GOPATH.

Source

Thrown at core/config/configtest/config.go:70

}

func gopathDevConfigDir() (string, error) {
	buf := bytes.NewBuffer(nil)
	cmd := exec.Command("go", "env", "GOPATH")
	cmd.Stdout = buf
	if err := cmd.Run(); err != nil {
		return "", err
	}

	gopath := strings.TrimSpace(buf.String())
	for _, p := range filepath.SplitList(gopath) {
		devPath := filepath.Join(p, "src/github.com/hyperledger/fabric/sampleconfig")
		if dirExists(devPath) {
			return devPath, nil
		}
	}

	return "", errors.New("unable to find sampleconfig directory on GOPATH")
}

func gomodDevConfigDir() (string, error) {
	buf := bytes.NewBuffer(nil)
	cmd := exec.Command("go", "env", "GOMOD")
	cmd.Stdout = buf

	if err := cmd.Run(); err != nil {
		return "", err
	}

	modFile := strings.TrimSpace(buf.String())
	if modFile == "" {
		return "", errors.New("not a module or not in module mode")
	}

	devPath := filepath.Join(filepath.Dir(modFile), "sampleconfig")
	if !dirExists(devPath) {

View on GitHub (pinned to 2736b63f8f)

Solutions

  1. Use Go module mode so gomodDevConfigDir resolves the sampleconfig dir next to go.mod
  2. Clone the fabric source into a GOPATH workspace
  3. Copy sampleconfig manually and point the test at it
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at core/config/configtest/config.go:70 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of hyperledger/fabric@2736b63f8f (2026-09-04). Data as JSON: /api/errors/65d59f4055a45982. Report an issue: GitHub.