{"record":{"id":"0a6fafdd3c0d55b0","repo":"dagger/dagger","slug":"find-go-work-w","errorCode":null,"errorMessage":"find go.work: %w","messagePattern":"find go\\.work: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/codegen/generator/go/generate_module.go","lineNumber":284,"sourceCode":"\tif err != nil {\n\t\treturn nil, false, err\n\t}\n\treturn &PackageInfo{\n\t\t// PackageName is unknown until we load the package\n\t\tPackageImport: path.Join(goMod.Module.Mod.Path, packageImport),\n\n\t\tDaggerPkgReplaced: isDaggerPkgCustomReplaced(goMod.Replace),\n\t}, needsRegen, nil\n}\n\nfunc (g *GoGenerator) syncModReplaceAndTidy(mod *modfile.File, genSt *generator.GeneratedState, modPath string) error {\n\tmodDir := filepath.Join(g.Config.OutputDir, modPath)\n\n\t// if there is a go.work, we need to also set overrides there, otherwise\n\t// modules will have individually conflicting replace directives\n\tgoWork, err := goEnv(modDir, \"GOWORK\")\n\tif err != nil {\n\t\treturn fmt.Errorf(\"find go.work: %w\", err)\n\t}\n\n\t// use Go SDK's embedded go.mod as basis for pinning versions\n\tsdkMod, err := modfile.Parse(\"go.mod\", dagger.GoMod, nil)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"parse embedded go.mod: %w\", err)\n\t}\n\tmodRequires := make(map[string]*modfile.Require)\n\tfor _, req := range mod.Require {\n\t\tmodRequires[req.Mod.Path] = req\n\t}\n\tfor _, minReq := range sdkMod.Require {\n\t\t// check if mod already at least this version\n\t\tif currentReq, ok := modRequires[minReq.Mod.Path]; ok {\n\t\t\tif semver.Compare(currentReq.Mod.Version, minReq.Mod.Version) >= 0 {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}","sourceCodeStart":266,"sourceCodeEnd":302,"githubUrl":"https://github.com/dagger/dagger/blob/82ba2681dbe30d3547a1dc50ea495900ab5b6047/cmd/codegen/generator/go/generate_module.go#L266-L302","documentation":"Wrap from syncModReplaceAndTidy when `go env GOWORK` fails in the module directory, i.e. the go toolchain could not be invoked to detect an active go.work file. Without this, replace-directive overrides cannot be synced safely.","triggerScenarios":"Thrown at cmd/codegen/generator/go/generate_module.go:284 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify a Go toolchain is installed and on PATH in the generation environment","Run `go env GOWORK` manually in the module dir to see the failure","Check GOFLAGS/GOCACHE settings that might break go env execution"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"82ba2681dbe30d3547a1dc50ea495900ab5b6047","analyzedAt":"2026-09-05T07:21:37.930Z","contentChangedAt":"2026-09-05T07:21:37.930Z","schemaVersion":2},"datasetVersion":"2026-09-12T12:17:11.808Z"}