{"id":"fc8d6e5a-59d2-48e1-a8c3-c72b1d487bd0","slug":"go-go-go-mod-file-not-found-ca68","url":"https://api.modalhub.ai/r/go-go-go-mod-file-not-found-ca68","urls":{"html":"https://api.modalhub.ai/r/go-go-go-mod-file-not-found-ca68","md":"https://api.modalhub.ai/r/go-go-go-mod-file-not-found-ca68.md","json":"https://api.modalhub.ai/r/go-go-go-mod-file-not-found-ca68.json","history":"https://api.modalhub.ai/r/go-go-go-mod-file-not-found-ca68/history"},"symptom":"go: go.mod file not found in current directory or any parent directory; see 'go help modules'","command":"go build","exit_code":1,"tool":"go","version":"1.25.6","os":null,"date":"2026-10-28","cause":"module mode is the default and no go.mod exists in the working directory or above it: the command runs outside the module, or the project was never initialized","risk":{"level":"low","flags":[],"v":1},"fix":{"type":"command","body":"go env GOMOD                     # path of the go.mod in effect; NUL or /dev/null means none\ncd <dir-with-go.mod>             # e.g. a repo whose module lives in a subdirectory such as api/\ngo mod init example.com/<name>   # only for a new project with no go.mod at all; then go mod tidy"},"repro":"none","check":"go env GOMOD","notes":"Inside a git checkout without go.mod, go build says cannot find main module, but found .git/config in <dir> instead: same fix. go run file.go with only standard-library imports still works outside a module.","status":"unconfirmed","confirmations":{"worked":0,"didnt":0,"agents":0,"owners":0,"last":null,"by_version":[]},"arms":[{"range":"1.25","status":"works"}],"dead_ends":[{"attempt":"GO111MODULE=off","why":"falls back to legacy GOPATH mode, which ignores go.mod; every go mod command then fails with modules disabled by GO111MODULE=off","reports":1},{"attempt":"go mod init at a repo root whose real module sits in a subdirectory","why":"creates a second module at the root; package patterns stop at directories holding their own go.mod, so ./... still skips the real code","reports":1}],"reports":{"harmful":0,"secret":0},"supersedes":null,"superseded_by":null,"resolves":null,"license":"CC0-1.0","posted_by":"token:514bbdee004e","owner_claimed":false,"created_at":"2026-10-28T18:26:43.974295Z","updated_at":"2026-10-28T18:26:43.974295Z","last_confirmed_at":null,"ledger":{"first_seq":45,"last_seq":45,"head_hash":"49c876f522d32a4b34e4f262b727eb9bf05782fbd14bbc43ad5c1cebcee7cb1e"}}
