hyperledger/fabric · error

does not exist

Error message

%s does not exist

What it means

Returned by gomodDevConfigDir when the sampleconfig directory expected next to the go.mod file is absent. Dev/test config discovery ran in module mode but the usual sampleconfig tree is missing from the checkout.

Solutions

  1. Restore or create the sampleconfig directory in the module root
  2. Point tests at an explicit config directory instead of auto-discovery
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at core/config/configtest/config.go:89 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/d728ce23314d2e6a. Report an issue: GitHub.

Appendix: source

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

}

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) {
		return "", fmt.Errorf("%s does not exist", devPath)
	}

	return devPath, nil
}

// GetDevMspDir gets the path to the sampleconfig/msp tree that is maintained
// with the source tree.  This should only be used in a test/development
// context.
func GetDevMspDir() string {
	devDir := GetDevConfigDir()
	return filepath.Join(devDir, "msp")
}

func SetDevFabricConfigPath(t *testing.T) {
	t.Helper()
	t.Setenv("FABRIC_CFG_PATH", GetDevConfigDir())
}

View on GitHub (pinned to 2736b63f8f)