{"record":{"id":"ac992096f2416f16","repo":"risingwavelabs/risingwave","slug":"fragments-not-found","errorCode":null,"errorMessage":"fragments {:?} not found","messagePattern":"fragments (.+?) not found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/meta/src/controller/scale.rs","lineNumber":484,"sourceCode":"        .flat_map(|ensemble| ensemble.components.iter().copied())\n        .collect();\n\n    let fragment_models = Fragment::find()\n        .filter(fragment::Column::FragmentId.is_in(required_fragment_ids.iter().copied()))\n        .all(txn)\n        .await?;\n\n    let found_fragment_ids: HashSet<_> = fragment_models\n        .iter()\n        .map(|fragment| fragment.fragment_id)\n        .collect();\n\n    if found_fragment_ids.len() != required_fragment_ids.len() {\n        let missing = required_fragment_ids\n            .difference(&found_fragment_ids)\n            .copied()\n            .collect_vec();\n        return Err(anyhow!(\"fragments {:?} not found\", missing).into());\n    }\n\n    let fragment_models: HashMap<_, _> = fragment_models\n        .into_iter()\n        .map(|fragment| (fragment.fragment_id, fragment))\n        .collect();\n\n    let job_ids: HashSet<_> = fragment_models\n        .values()\n        .map(|fragment| fragment.job_id)\n        .collect();\n\n    if job_ids.is_empty() {\n        return Ok(LoadedFragmentContext::default());\n    }\n\n    let jobs: HashMap<_, _> = StreamingJob::find()\n        .filter(streaming_job::Column::JobId.is_in(job_ids.iter().copied().collect_vec()))","sourceCodeStart":466,"sourceCodeEnd":502,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/meta/src/controller/scale.rs#L466-L502","documentation":"load_fragment_context fetches all Fragment rows referenced by the given no-shuffle ensembles. If the DB returns fewer fragments than the ensemble components require, the missing fragment IDs are reported with this anyhow error. It guarantees the renderer never proceeds with partially-known topology.","triggerScenarios":"Calling load_fragment_context with ensembles whose component fragment IDs no longer exist in the fragments table — e.g. rescale API invoked with stale ensemble info after the fragments were deleted by a job cancel/replace, or cross-job ensembles referencing foreign fragments.","commonSituations":"A scale/rescale request racing with DDL that drops fragments; meta store rollback leaving ensembles pointing at removed fragments; operator tooling replaying old ensemble snapshots.","solutions":["Re-fetch fresh ensemble data (re-run the load stage against the current catalog) instead of using cached/stale ensembles.","Identify the listed missing fragment IDs and confirm whether their job was dropped; if so, exclude those ensembles or cancel the rescale request.","Retry the rescale when no conflicting DDL is in flight.","If the fragments should exist, check meta store consistency/backup."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"let existing: HashSet<_> = Fragment::find()\n    .filter(fragment::Column::FragmentId.is_in(required_ids.iter().copied()))\n    .all(txn).await?\n    .into_iter().map(|f| f.fragment_id).collect();\nlet missing: Vec<_> = required_ids.difference(&existing).collect();\nif !missing.is_empty() { return Err(anyhow!(\"stale ensembles, missing fragments {missing:?}\")); }","typeGuard":null,"tryCatchPattern":"match load_fragment_context(txn, ensembles).await {\n    Ok(ctx) => proceed(ctx),\n    Err(e) if e.to_string().contains(\"not found\") => refresh_ensembles_and_retry(),\n    Err(e) => return Err(e),\n}","preventionTips":["Always derive ensembles from a fresh catalog read, never cached state","Serialize rescale with job DDL via the meta serialization layer","Re-read ensemble data after any failed operation","Monitor for orphaned fragment rows"],"tags":["meta","rescale","fragment","metadata"],"backgroundTag":"resource-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"}