{"record":{"id":"4418e5498d97e034","repo":"risingwavelabs/risingwave","slug":"failed-to-find-fragment","errorCode":null,"errorMessage":"failed to find fragment: {}","messagePattern":"failed to find fragment: (.+?)","errorType":"exception","errorClass":"MetaError","httpStatus":null,"severity":"error","filePath":"src/meta/src/controller/fragment.rs","lineNumber":1768,"sourceCode":"                    source_backfill_fragment_id\n                )\n            })?;\n\n        if fragment_relation != DispatcherType::NoShuffle {\n            return Err(anyhow!(\"expected NoShuffle but got {:?}\", fragment_relation).into());\n        }\n\n        let load_fragment_distribution_type = |txn, fragment_id: FragmentId| async move {\n            let result: MetaResult<DistributionType> = try {\n                FragmentModel::find_by_id(fragment_id)\n                    .select_only()\n                    .column(fragment::Column::DistributionType)\n                    .into_tuple()\n                    .one(txn)\n                    .await\n                    .map_err(MetaError::from)?\n                    .ok_or_else(|| {\n                        MetaError::from(anyhow!(\"failed to find fragment: {}\", fragment_id))\n                    })?\n            };\n            result\n        };\n\n        let source_backfill_distribution_type =\n            load_fragment_distribution_type(&txn, source_backfill_fragment_id).await?;\n        let source_distribution_type =\n            load_fragment_distribution_type(&txn, source_fragment_id).await?;\n\n        let load_fragment_actor_distribution =\n            |actor_info: &SharedActorInfos,\n             fragment_id: FragmentId|\n             -> HashMap<crate::model::ActorId, Option<Bitmap>> {\n                let guard = actor_info.read_guard();\n\n                guard\n                    .get_fragment(fragment_id as _)","sourceCodeStart":1750,"sourceCodeEnd":1786,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/meta/src/controller/fragment.rs#L1750-L1786","documentation":"The closure load_fragment_distribution_type queries the fragment table for the distribution type of a given fragment id; if the query returns no row it raises MetaError::from(anyhow!(\"failed to find fragment: {}\")), i.e. a fragment the backfill rewrite depends on does not exist in the meta database.","triggerScenarios":"Running source backfill rewrite when source_backfill_fragment_id (or the source fragment) has no row in the fragment table — partial fragment persistence, concurrent drop of the job, or ids pointing at fragments from a dropped/recreated table.","commonSituations":"Interrupted DDL leaving relation rows without fragment rows; querying a job mid-drop; meta store restored from an inconsistent backup; version migration gaps.","solutions":["Verify the fragment row exists: query the fragment table for the reported fragment_id","Check whether the owning streaming job was concurrently dropped and retry or abandon the rewrite accordingly","If a partial write occurred (relations present, fragments missing), restore meta data from a consistent backup","File an issue with the meta logs if stock DDL leaves orphaned relation rows"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"let n = Fragment::find().filter(fragment::Column::FragmentId.eq(fid)).count(&db).await?;\nif n == 0 { return Err(fragment_missing(fid)); }","typeGuard":null,"tryCatchPattern":"match get_job_fragments_by_id(job_id).await { Err(e) if e.to_string().contains(\"failed to find fragment\") => handle_partial_metadata(job_id), other => other }","preventionTips":["Ensure DDL writes fragments and relations atomically","Abort backfill rewrites for jobs being concurrently dropped","Restore meta data only from consistent backups"],"tags":["fragment","database","not-found","backfill"],"backgroundTag":"record-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"}