{"record":{"id":"fd25f6ca1998d2fd","repo":"risingwavelabs/risingwave","slug":"previous-fragment-info-for-fragment-id-not-found","errorCode":null,"errorMessage":"previous fragment info for {fragment_id} not found","messagePattern":"previous fragment info for (.+?) not found","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/meta/src/stream/scale.rs","lineNumber":821,"sourceCode":"        .flatten()\n        .map(|(fragment_id, _)| *fragment_id)\n        .collect_vec();\n\n    let all_related_fragment_ids: HashSet<_> = fragment_ids\n        .iter()\n        .copied()\n        .chain(all_upstream_fragments.values().flatten().map(|(id, _)| *id))\n        .chain(\n            all_downstream_fragments\n                .values()\n                .flatten()\n                .map(|(id, _)| *id),\n        )\n        .collect();\n\n    for fragment_id in all_related_fragment_ids {\n        if !all_prev_fragments.contains_key(&fragment_id) {\n            return Err(MetaError::from(anyhow!(\n                \"previous fragment info for {fragment_id} not found\"\n            )));\n        }\n    }\n\n    let all_rendered_fragments: HashMap<_, _> = render_result\n        .values()\n        .flat_map(|jobs| jobs.values())\n        .flatten()\n        .map(|(fragment_id, info)| (*fragment_id, info))\n        .collect();\n\n    let mut commands = HashMap::new();\n\n    for (database_id, jobs) in &render_result {\n        let mut all_fragment_actors = HashMap::new();\n        let mut reschedules = HashMap::new();\n","sourceCodeStart":803,"sourceCodeEnd":839,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/meta/src/stream/scale.rs#L803-L839","documentation":"`build_reschedule_commands` first collects all fragment ids related to the reschedule (from the diff and rendered plan) and asserts each one exists in `all_prev_fragments`, the snapshot of the job's current fragments. If any related fragment id is absent from that snapshot, planning cannot proceed and this error is returned. It ensures the reschedule plan is grounded in the job's existing fragment state.","triggerScenarios":"Calling `build_reschedule_from_context` where the diff/render step references a fragment id (e.g. a downstream or upstream fragment discovered through the dependency graph) that is not present in the previous-fragment snapshot passed into the context.","commonSituations":"Rescheduling while the fragment graph is mid-update (e.g. a parallel schema change added/removed fragments); building the context from a stale or partial snapshot that omits external/downstream fragments; job topology changed since the snapshot was taken.","solutions":["Retry the reschedule after any concurrent DDL (schema change, refresh, creation) on the job completes.","Rebuild the reschedule context so `all_prev_fragments` includes all related fragments, including downstream/external ones.","From the logged fragment_id, check which relation/graph edge references it and ensure that fragment is collected into the snapshot.","If a recently created fragment is missing, verify the snapshot is fetched after the fragment becomes visible in the meta state."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// verify all related fragment ids exist in the snapshot before planning\nlet missing: Vec<_> = related_fragment_ids\n    .iter()\n    .filter(|id| !prev_fragments.contains_key(*id))\n    .collect();\nif !missing.is_empty() { return Err(format!(\"stale context, missing: {missing:?}\")); }","typeGuard":null,"tryCatchPattern":"match build_reschedule_from_context(ctx).await {\n    Err(e) if e.to_string().contains(\"not found\") => {\n        let ctx = refresh_context_after_ddl_settles().await?;\n        build_reschedule_from_context(ctx).await\n    }\n    r => r,\n}","preventionTips":["Wait for concurrent DDL on the job (and its upstream/downstream) to complete before rescheduling.","Build the reschedule context from a single consistent meta snapshot.","Include external/downstream fragments when collecting the previous-state snapshot."],"tags":["reschedule","fragment","scale"],"backgroundTag":"entity-not-found","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"}