{"record":{"id":"f13e758b8331a05c","repo":"risingwavelabs/risingwave","slug":"fragment-id-from-actor-is-different-from-fra","errorCode":null,"errorMessage":"fragment id {} from actor {} is different from fragment {}","messagePattern":"fragment id (.+?) from actor (.+?) is different from fragment (.+?)","errorType":"exception","errorClass":"MetaError","httpStatus":null,"severity":"error","filePath":"src/meta/src/controller/fragment.rs","lineNumber":427,"sourceCode":"        let stream_node = stream_node.to_protobuf();\n        let mut upstream_fragments = HashSet::new();\n        visit_stream_node_body(&stream_node, |body| {\n            if let NodeBody::Merge(m) = body {\n                assert!(\n                    upstream_fragments.insert(m.upstream_fragment_id),\n                    \"non-duplicate upstream fragment\"\n                );\n            }\n        });\n\n        let mut pb_actors = vec![];\n\n        let mut pb_actor_status = HashMap::new();\n        let mut pb_actor_splits = HashMap::new();\n\n        for actor in actors {\n            if actor.fragment_id != fragment_id {\n                bail!(\n                    \"fragment id {} from actor {} is different from fragment {}\",\n                    actor.fragment_id,\n                    actor.actor_id,\n                    fragment_id\n                )\n            }\n\n            let ActorInfo {\n                actor_id,\n                fragment_id,\n                worker_id,\n                splits,\n                vnode_bitmap,\n                expr_context,\n                config_override,\n                ..\n            } = actor;\n","sourceCodeStart":409,"sourceCodeEnd":445,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/meta/src/controller/fragment.rs#L409-L445","documentation":"compose_fragment validates that every actor passed for a fragment actually declares the same fragment_id as the fragment being composed. If any actor's `fragment_id` disagrees with the enclosing `fragment_id`, the metadata would be internally inconsistent (an actor attached to the wrong fragment), so the controller bails out before persisting the fragment.","triggerScenarios":"Calling CatalogController::compose_fragment (internally during table fragment creation/persisting, e.g. create table MV/materialized view flow) with an actors list where at least one Actor has fragment_id != the fragment's id — typically a bug in code that groups actors into fragments.","commonSituations":"Custom stream plan generation or patched actor distribution code that assigns actors to fragments incorrectly; internal state corruption between the stream graph builder and the fragment composer; merging fragments from an older cluster upgraded across versions where actor metadata format changed.","solutions":["Check where the actors vector was built and ensure each actor.fragment_id is set from the same fragment being composed","Log the offending actor_id and fragment_id from the message to find which grouping step produced the mismatch","If this follows an upgrade or manual meta-store edits, verify the streaming_job/actor rows in the meta DB are consistent","Report a bug to RisingWave if the mismatch arises from stock plan creation, since callers are internal"],"exampleFix":"// before\nlet actors = build_actors(&plan); // actors may span fragments\n// after\nlet actors: Vec<_> = all_actors.into_iter().filter(|a| a.fragment_id == fragment_id).collect();","handlingStrategy":"validation","validationCode":"assert!(actors.iter().all(|a| a.fragment_id == fragment_id), \"actor/fragment id mismatch\");","typeGuard":"fn all_actors_match_fragment(actors: &[Actor], fragment_id: FragmentId) -> bool { actors.iter().all(|a| a.fragment_id == fragment_id) }","tryCatchPattern":null,"preventionTips":["Derive each actor's fragment_id from the same loop that builds the fragment","Filter actors by fragment_id before composing","Add a debug assertion in actor-building code"],"tags":["internal-invariant","fragment","actor","metadata"],"backgroundTag":"internal-invariant-violation","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"}