{"record":{"id":"90191ec3d29cfff0","repo":"apache/beam","slug":"strictness-check-failed","errorCode":null,"errorMessage":"strictness check failed","messagePattern":"strictness check failed","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/runners/direct/direct.go","lineNumber":58,"sourceCode":"\tbeam.RegisterRunner(\"DirectRunner\", Execute)\n}\n\n// Execute runs the pipeline in-process.\nfunc Execute(ctx context.Context, p *beam.Pipeline) (beam.PipelineResult, error) {\n\tlog.Info(ctx, \"Executing pipeline with the direct runner.\")\n\n\tif !beam.Initialized() {\n\t\tlog.Warn(ctx, \"Beam has not been initialized. Call beam.Init() before pipeline construction.\")\n\t}\n\n\tlog.Info(ctx, \"Pipeline:\")\n\tlog.Info(ctx, p)\n\tctx = metrics.SetBundleID(ctx, \"direct\") // Ensure a metrics.Store exists.\n\n\tif *jobopts.Strict {\n\t\tlog.Info(ctx, \"Strict mode enabled, applying additional validation.\")\n\t\tif _, err := vet.Execute(ctx, p); err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"strictness check failed\")\n\t\t}\n\t\tlog.Info(ctx, \"Strict mode validation passed.\")\n\t}\n\n\tedges, _, err := p.Build()\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"invalid pipeline\")\n\t}\n\tplan, err := Compile(edges)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"translation failed\")\n\t}\n\tbeam.PipelineOptions.LoadOptionsFromFlags(nil)\n\tlog.Info(ctx, plan)\n\n\tif err = plan.Execute(ctx, \"\", exec.DataContext{}); err != nil {\n\t\tplan.Down(ctx) // ignore any teardown errors\n\t\treturn nil, err","sourceCodeStart":40,"sourceCodeEnd":76,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/runners/direct/direct.go#L40-L76","documentation":"The direct runner's Execute checks the jobopts.Strict flag; when strict mode is on it runs the pipeline through the vet framework (vet.Execute) before building. If any structural validation fails (bad input/output types, unreachable nodes, incorrect DoFn signatures), the collected errors are wrapped as 'strictness check failed'.","triggerScenarios":"Running beam.Run with the direct runner while the 'strict' pipeline option is enabled and vet.Execute reports pipeline-structure violations (e.g. mismatched PCollection types, misuse of beam.ParDo with wrong signature).","commonSituations":"Developers enabling strict mode to catch pipeline bugs early; CI pipelines that set strict validation; newly migrated pipelines (e.g. from another SDK) with subtly wrong graph construction; custom transforms violating vet rules.","solutions":["Read the inner vet errors in the wrapped message; each names the offending node/rule — fix the indicated transform wiring.","Check DoFn signatures (ProcessElement parameter/return types) against the input/output PCollections.","If strict mode was enabled unintentionally, unset the strict job option (do not pass --strict / set jobopts.Strict=false).","Run vet.Execute in a unit test to reproduce and fix the validation findings without executing the pipeline."],"exampleFix":"// before\npOpts := beam.NewPipelineOptions()\n// strict flag left on from CLI, pipeline has a bad DoFn signature\n_, err := beam.Run(ctx, \"direct\", p, pOpts) // strictness check failed\n// after\nfunc (fn myFn) ProcessElement(ctx context.Context, v string, emit func(string)) { ... } // fix signature, or:\n// unset strict: remove --strict flag / beam.PipelineOptions strict setting","handlingStrategy":"try-catch","validationCode":"if _, err := vet.Execute(ctx, p); err != nil {\n    t.Fatalf(\"pipeline fails strict validation: %v\", err)\n}","typeGuard":null,"tryCatchPattern":"if _, err := beam.Run(ctx, \"direct\", p); err != nil {\n    var se interface{ Error() string }\n    if errors.As(err, &se) && strings.Contains(err.Error(), \"strictness check failed\") {\n        log.Printf(\"fix pipeline structure reported by vet: %v\", err)\n    }\n}","preventionTips":["Run vet.Execute in unit tests before running pipelines.","Keep DoFn signatures conforming to the documented patterns.","Enable strict mode in CI to catch structural issues early."],"tags":["go","beam","direct-runner","validation","pipeline"],"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-14T21:17:11.552Z"}