apache/beam · error · IllegalStateException
Unable to locate window for successful request
Error message
Unable to locate window for successful request
What it means
coerceNonNull exists solely to satisfy Error Prone's nullness analysis when associating a successful write request with a window. If the tracked successfulWindow is null at flush time despite a successful request having been recorded, the invariant 'a success implies a window' is broken and this IllegalStateException is thrown.
Solutions
- Upgrade apache-beam (google-cloud-platform) to the latest release where flush/window bookkeeping fixes are included
- If reproducible, capture the DoFn stack trace and file a Beam Jira issue (BEAM-*) with the pipeline topology
- Work around by restructuring the write (smaller batches / fewer concurrent windows) to reduce the race window
- As a stopgap, catch the failure in the error-handling output so the bundle can proceed without crashing
Defensive patterns
Strategy: try-catch
Try / catch
try { /* write flush */ } catch (IllegalStateException e) { if (e.getMessage().contains("Unable to locate window")) { // treat batch as failed, re-buffer or route to error output } else { throw e; } } Prevention
- Use a recent Beam release; this is an internal invariant and mostly fixed upstream
- Avoid extreme batching configs (very large groups/many concurrent windows) that stress flush bookkeeping
- Route write failures to an error-handling output rather than crashing the bundle
When it happens
Trigger: doFlush reports an OK/OK_BATCHED status but no window was recorded alongside the successful request — an internal state bug in FirestoreV1WriteFn's batching, typically under retry/bundle-failure edge cases.
Common situations: Race between batching and window bookkeeping under heavy load; connector bugs surfaced in production; interactions with resharding or bundle retries that lose the successful-request window.
Understand the failure class
Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.
Related errors
- Array of collection is not supported in BigQuery.
- bad window kind
- bad window
- bad windowed value
- bad windowed value: %+v
AI-assisted analysis of apache/beam@12126d8942 (2026-09-13).
Data as JSON: /api/errors/2d10e1a1331ab5cc.
Report an issue: GitHub.
Appendix: source
Thrown at sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/firestore/FirestoreV1WriteFn.java:532
}
return DoFlushStatus.ONE_OR_MORE_FAILURES;
}
}
}
/**
* Window values are part of the WriteElement which is used to full the flushBuffer and
* accessible after the response is returned. Our FlushBuffer is ensured to be non-empty before
* passed to this method, so the loop above will always iterate at least once and by virtue of
* this method only being when at least one ok status OK is present successfulWindow will be
* non-null.
*
* <p>This method is here to prove to error prone that the value of successfulWindow we are
* passing along is in fact non-null.
*/
private static BoundedWindow coerceNonNull(@Nullable BoundedWindow successfulWindow) {
if (successfulWindow == null) {
throw new IllegalStateException("Unable to locate window for successful request");
}
return successfulWindow;
}
private enum DoFlushStatus {
OK,
ONE_OR_MORE_FAILURES
}
abstract void handleWriteFailures(
ContextAdapter<OutT> context,
List<KV<WriteFailure, BoundedWindow>> writeFailures,
Runnable logMessage);
abstract void handleWriteSummary(
ContextAdapter<OutT> context,
Instant timestamp,
KV<WriteSuccessSummary, BoundedWindow> tuple,View on GitHub (pinned to 12126d8942)