{"record":{"id":"1c0b67fa13a7b836","repo":"apache/beam","slug":"failed-to-type-check-package-s","errorCode":null,"errorMessage":"failed to type check package %s","messagePattern":"failed to type check package (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/util/starcgenx/starcgenx.go","lineNumber":153,"sourceCode":"\t\tconf.IgnoreFuncBodies = true\n\t\tif len(e.Ids) != 0 {\n\t\t\t// TODO(lostluck): This becomes unnnecessary iff we can figure out\n\t\t\t// which ParDos are being passed to beam.ParDo or beam.Combine.\n\t\t\t// If there are ids, we need to also look at function bodies, and uses.\n\t\t\tvar checkFuncBodies bool\n\t\t\tfor _, v := range e.Ids {\n\t\t\t\tif strings.Contains(v, \".\") {\n\t\t\t\t\tcheckFuncBodies = true\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tconf.IgnoreFuncBodies = !checkFuncBodies\n\t\t\tinfo.Uses = make(map[*ast.Ident]types.Object)\n\t\t}\n\t}\n\n\tif _, err := conf.Check(e.Package, fset, files, info); err != nil {\n\t\treturn errors.Wrapf(err, \"failed to type check package %s\", e.Package)\n\t}\n\n\te.Print(\"/*\\n\")\n\te.Print(\"CHECKING for RegisterDoFn EXPRs\\n\")\n\tvisitor := findRegisterDoFnCalls{info, e, make(map[string]bool)}\n\tfor _, file := range files {\n\t\tast.Walk(visitor, file)\n\t}\n\tfor id := range visitor.idsToFind {\n\t\te.Ids = append(e.Ids, id)\n\t}\n\n\tvar idsRequired, idsFound map[string]bool\n\tif len(e.Ids) > 0 {\n\t\te.Printf(\"Filtering by %d identifiers: %q\\n\\n\", len(e.Ids), strings.Join(e.Ids, \", \"))\n\t\tidsRequired = make(map[string]bool)\n\t\tidsFound = make(map[string]bool)\n\t\tfor _, id := range e.Ids {","sourceCodeStart":135,"sourceCodeEnd":171,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/util/starcgenx/starcgenx.go#L135-L171","documentation":"starcgenx.FromAsts type-checks the parsed Go ASTs with go/types before generating stubs. If conf.Check fails (the package doesn't compile), the SDK cannot resolve identifiers, so it wraps the type-checker error naming the package.","triggerScenarios":"Running starcgenx code generation on a package whose files fail to type check — syntax errors, unresolved imports, missing dependencies, or version mismatch between generated code and Go version.","commonSituations":"Running the generator on an incomplete/generated-in-progress package; GOPATH/module not set up so imports can't be resolved; cross-compiling with an unsupported Go release.","solutions":["Run `go build ./...` (or `go vet`) on the target package first and fix compile errors.","Ensure all imports resolve (go mod tidy) and the generator is run from the module root.","Check that the Go version used to run the generator matches the target package's language version."],"exampleFix":"// before\n$ starcgenx -package=broken/pkg -o stubs.go\n// after: fix package first\n$ go build ./broken/pkg && starcgenx -package=broken/pkg -o stubs.go","handlingStrategy":"validation","validationCode":"// Run before invoking the generator:\n// go build ./...  (or go vet ./path/to/pkg)\n// if it fails, fix compile errors first","typeGuard":null,"tryCatchPattern":"if err := starcgenx.FromAsts(e, fset, files); err != nil {\n    log.Fatalf(\"generation aborted: %v — run go build on the package to see the underlying type error\", err)\n}","preventionTips":["Always run `go build` on the target package before code generation.","Run the generator from the module root with dependencies tidied (go mod tidy).","Keep the generator's Go version aligned with the project's go directive."],"tags":["go","code-generation","type-check"],"backgroundTag":"schema-validation-failed","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-20T03:17:13.778Z"}