{"record":{"id":"4254a6f31531c7a8","repo":"hyperledger/fabric","slug":"not-a-module-or-not-in-module-mode","errorCode":null,"errorMessage":"not a module or not in module mode","messagePattern":"not a module or not in module mode","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/config/configtest/config.go","lineNumber":84,"sourceCode":"\t\t\treturn devPath, nil\n\t\t}\n\t}\n\n\treturn \"\", errors.New(\"unable to find sampleconfig directory on GOPATH\")\n}\n\nfunc gomodDevConfigDir() (string, error) {\n\tbuf := bytes.NewBuffer(nil)\n\tcmd := exec.Command(\"go\", \"env\", \"GOMOD\")\n\tcmd.Stdout = buf\n\n\tif err := cmd.Run(); err != nil {\n\t\treturn \"\", err\n\t}\n\n\tmodFile := strings.TrimSpace(buf.String())\n\tif modFile == \"\" {\n\t\treturn \"\", errors.New(\"not a module or not in module mode\")\n\t}\n\n\tdevPath := filepath.Join(filepath.Dir(modFile), \"sampleconfig\")\n\tif !dirExists(devPath) {\n\t\treturn \"\", fmt.Errorf(\"%s does not exist\", devPath)\n\t}\n\n\treturn devPath, nil\n}\n\n// GetDevMspDir gets the path to the sampleconfig/msp tree that is maintained\n// with the source tree.  This should only be used in a test/development\n// context.\nfunc GetDevMspDir() string {\n\tdevDir := GetDevConfigDir()\n\treturn filepath.Join(devDir, \"msp\")\n}\n","sourceCodeStart":66,"sourceCodeEnd":102,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/core/config/configtest/config.go#L66-L102","documentation":"gomodDevConfigDir ran 'go env GOMOD' and got an empty string, meaning the process is not inside a Go module (classic GOPATH mode or no go.mod). The module root is needed to locate the adjacent sampleconfig directory.","triggerScenarios":"Thrown at core/config/configtest/config.go:84 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Run from within the fabric module (ensure a go.mod is present)","Set GO111MODULE=on in the environment","Fall back to a GOPATH-based dev config dir"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"2736b63f8fd5932511d56fe68b7039d15977f7f6","analyzedAt":"2026-09-04T08:52:36.465Z","contentChangedAt":"2026-09-04T08:52:36.465Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}