{"record":{"id":"54161c2a13ba7edb","repo":"risingwavelabs/risingwave","slug":"failed-to-align-barrier-expected-0-but-got","errorCode":null,"errorMessage":"Failed to align barrier: expected `{0:?}` but got `{1:?}`","messagePattern":"Failed to align barrier: expected `(.+?)` but got `(.+?)`","errorType":"error_code","errorClass":"StreamExecutorError","httpStatus":null,"severity":"error","filePath":"src/stream/src/executor/error.rs","lineNumber":95,"sourceCode":"\n    #[error(transparent)]\n    RpcError(\n        #[from]\n        #[backtrace]\n        RpcError,\n    ),\n\n    #[error(\"Channel closed: {0}\")]\n    ChannelClosed(String),\n\n    #[error(transparent)]\n    ExchangeChannelClosed(\n        #[from]\n        #[backtrace]\n        ExchangeChannelClosed,\n    ),\n\n    #[error(\"Failed to align barrier: expected `{0:?}` but got `{1:?}`\")]\n    AlignBarrier(Box<Barrier>, Box<Barrier>),\n\n    #[error(\"Connector error: {0}\")]\n    ConnectorError(\n        #[source]\n        #[backtrace]\n        BoxedError,\n    ),\n\n    #[error(transparent)]\n    DmlError(\n        #[from]\n        #[backtrace]\n        DmlError,\n    ),\n\n    #[error(transparent)]\n    NotImplemented(#[from] NotImplemented),","sourceCodeStart":77,"sourceCodeEnd":113,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/stream/src/executor/error.rs#L77-L113","documentation":"The AlignBarrier variant is thrown when a barrier executor receives a barrier that does not match the one it is currently expecting during barrier alignment. The message shows both barriers: expected `{0:?}` but got `{1:?}`. Barrier alignment guarantees all actors process the same barriers in the same order; a mismatch means the epoch/stream ordering is broken.","triggerScenarios":"During BarrierAlignExecutor processing, when the incoming barrier's epoch (or type, e.g. checkpoint vs config-change) differs from the expected barrier: expected={:?} got={:?}. Constructed with two boxed Barrier values.","commonSituations":"Bugs or races in barrier injection/dispatch from the meta node; actor restarted mid-stream and missed a barrier; corrupted or reordered message delivery in the exchange layer.","solutions":["Compare the two printed barriers (epochs and variants) to identify the divergence point.","Check meta node barrier injection logs for skipped or duplicated epochs.","Look for actor restarts around that epoch that may have missed barriers.","File an issue with the full error (both barriers) if reproducible — this usually indicates an internal invariant violation rather than user error."],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":"// before processing, assert barrier epoch continuity\ndebug_assert_eq!(incoming.epoch, expected.epoch, \"barrier epoch mismatch\");\nif incoming.epoch != expected.epoch {\n    tracing::error!(expected = ?expected, got = ?incoming, \"barrier misalignment\");\n}","typeGuard":"fn is_align_barrier_error(e: &StreamExecutorError) -> bool {\n    e.variant_name() == \"AlignBarrier\"\n}","tryCatchPattern":"if let Err(e) = res {\n    if e.variant_name() == \"AlignBarrier\" {\n        // log both barriers (expected vs got) and trigger actor failover\n        tracing::error!(error = ?e, \"barrier alignment failed; failing over\");\n        return Err(e);\n    }\n    return Err(e);\n}","preventionTips":["Keep meta barrier injection single-threaded and ordered per actor.","Avoid restarting actors mid-epoch without barrier recovery.","Upgrade together with fixes to barrier dispatch races.","Capture both barrier payloads when reporting this error."],"tags":["barrier","consistency","stream-executor"],"backgroundTag":"invalid-state-transition","analyzedSha":"6469eb736d691e8e9b8a419a57edd6429ca77417","analyzedAt":"2026-09-11T21:06:21.487Z","contentChangedAt":"2026-09-11T21:06:21.487Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}