apache/beam · error

strictness check failed

Error message

strictness check failed

What it means

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'.

Source

Thrown at sdks/go/pkg/beam/runners/direct/direct.go:58

	beam.RegisterRunner("DirectRunner", Execute)
}

// Execute runs the pipeline in-process.
func Execute(ctx context.Context, p *beam.Pipeline) (beam.PipelineResult, error) {
	log.Info(ctx, "Executing pipeline with the direct runner.")

	if !beam.Initialized() {
		log.Warn(ctx, "Beam has not been initialized. Call beam.Init() before pipeline construction.")
	}

	log.Info(ctx, "Pipeline:")
	log.Info(ctx, p)
	ctx = metrics.SetBundleID(ctx, "direct") // Ensure a metrics.Store exists.

	if *jobopts.Strict {
		log.Info(ctx, "Strict mode enabled, applying additional validation.")
		if _, err := vet.Execute(ctx, p); err != nil {
			return nil, errors.Wrap(err, "strictness check failed")
		}
		log.Info(ctx, "Strict mode validation passed.")
	}

	edges, _, err := p.Build()
	if err != nil {
		return nil, errors.Wrap(err, "invalid pipeline")
	}
	plan, err := Compile(edges)
	if err != nil {
		return nil, errors.Wrap(err, "translation failed")
	}
	beam.PipelineOptions.LoadOptionsFromFlags(nil)
	log.Info(ctx, plan)

	if err = plan.Execute(ctx, "", exec.DataContext{}); err != nil {
		plan.Down(ctx) // ignore any teardown errors
		return nil, err

View on GitHub (pinned to 12126d8942)

Solutions

  1. Read the inner vet errors in the wrapped message; each names the offending node/rule — fix the indicated transform wiring.
  2. Check DoFn signatures (ProcessElement parameter/return types) against the input/output PCollections.
  3. If strict mode was enabled unintentionally, unset the strict job option (do not pass --strict / set jobopts.Strict=false).
  4. Run vet.Execute in a unit test to reproduce and fix the validation findings without executing the pipeline.

Example fix

// before
pOpts := beam.NewPipelineOptions()
// strict flag left on from CLI, pipeline has a bad DoFn signature
_, err := beam.Run(ctx, "direct", p, pOpts) // strictness check failed
// after
func (fn myFn) ProcessElement(ctx context.Context, v string, emit func(string)) { ... } // fix signature, or:
// unset strict: remove --strict flag / beam.PipelineOptions strict setting
Defensive patterns

Strategy: try-catch

Validate before calling

if _, err := vet.Execute(ctx, p); err != nil {
    t.Fatalf("pipeline fails strict validation: %v", err)
}

Try / catch

if _, err := beam.Run(ctx, "direct", p); err != nil {
    var se interface{ Error() string }
    if errors.As(err, &se) && strings.Contains(err.Error(), "strictness check failed") {
        log.Printf("fix pipeline structure reported by vet: %v", err)
    }
}

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


AI-assisted analysis of apache/beam@12126d8942 (2026-09-13). Data as JSON: /api/errors/90191ec3d29cfff0. Report an issue: GitHub.