apache/beam · error

%d missing entries (missing in actual, present in expected)

Error message

%d missing entries (missing in actual, present in expected)

What it means

passert.Equals (and its float/string variants) compare an observed PCollection against an expected one by stringifying elements. failIfBadEntries builds a diagnostic report; when actual values lack entries present in the expected set, it produces 'N missing entries (missing in actual, present in expected)' followed by each missing entry. It is a test-assertion failure meaning your pipeline produced a different result set than expected.

Source

Thrown at sdks/go/pkg/beam/testing/passert/equals.go:104

		"actual PCollection does not match expected values",
		partSeparator,
		fmt.Sprintf("%d correct entries (present in both)", goodCount),
		partSeparator,
		fmt.Sprintf("%d unexpected entries (present in actual, missing in expected)", len(unexpectedStrings)),
	}
	for _, entry := range unexpectedStrings {
		outStrings = append(outStrings, "+++", entry)
	}

	outStrings = append(
		outStrings,
		partSeparator,
		fmt.Sprintf("%d missing entries (missing in actual, present in expected)", len(missingStrings)),
	)
	for _, entry := range missingStrings {
		outStrings = append(outStrings, "---", entry)
	}
	return errors.New(strings.Join(outStrings, "\n"))
}

func readToStrings(iter func(*beam.T) bool) []string {
	out := []string{}
	var inVal beam.T
	for iter(&inVal) {
		out = append(out, fmt.Sprint(inVal))
	}
	sort.Strings(out)
	return out
}

View on GitHub (pinned to 12126d8942)

Solutions

  1. Read the entries listed after '---' in the error to see exactly which values are missing
  2. Fix the transform logic that drops those elements (filters, windows, dedup)
  3. Verify windowing and triggering so elements are not lost before the assertion
  4. Confirm expected values match the actual element encoding (stringification)

Example fix

// before
// test fails: 1 missing entries (missing in actual, present in expected)
// --- world
passert.Equals(s, words, "hello", "world") // but 'world' was filtered out
// after
words = beam.ParDo(s, &removeStopWordsFn{}, words) // fix the filter so 'world' survives
passert.Equals(s, words, "hello", "world")
Defensive patterns

Strategy: validation

Validate before calling

// sanity-check expected contents before asserting
if len(expected) == 0 {
	t.Fatal("expected list must not be empty for passert.Equals")
}

Try / catch

if err := passert.Equals(s, col, expected); err != nil {
	// err text lists missing entries after '---'; dump observed for diffing
	t.Fatalf("passert failed: %v", err)
}

Prevention

When it happens

Trigger: Calling passert.Equals(s, col, expectedList) in tests where the pipeline output omits one or more expected values — wrong windowing, filtering, dedup, or side-input logic.

Common situations: Beam pipeline unit tests failing after logic changes; nondeterministic pipelines dropping elements; windowing/timestamp issues causing elements to be dropped at window boundaries.

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/7300f9fc23c868e9. Report an issue: GitHub.