{"record":{"id":"89cea70986e7eb00","repo":"risingwavelabs/risingwave","slug":"streaming-job-job-id-not-found-in-streaming-job","errorCode":null,"errorMessage":"streaming job {job_id} not found in streaming_job_databases","messagePattern":"streaming job (.+?) not found in streaming_job_databases","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/meta/src/controller/scale.rs","lineNumber":1076,"sourceCode":"                            vnode_bitmap,\n                            splits: splits.remove(&actor_id).unwrap_or_default(),\n                        },\n                    )\n                })\n                .collect();\n\n            let fragment = InflightFragmentInfo {\n                fragment_id,\n                distribution_type,\n                fragment_type_mask,\n                vnode_count,\n                nodes: stream_node.clone(),\n                actors,\n                state_table_ids: state_table_ids.clone(),\n            };\n\n            let &database_id = streaming_job_databases.get(&job_id).ok_or_else(|| {\n                anyhow!(\"streaming job {job_id} not found in streaming_job_databases\")\n            })?;\n\n            all_fragments\n                .entry(database_id)\n                .or_default()\n                .entry(job_id)\n                .or_default()\n                .insert(fragment_id, fragment);\n        }\n    }\n\n    Ok(all_fragments)\n}\n\npub(crate) struct EnsembleActorTemplate {\n    assignment: BTreeMap<WorkerId, BTreeMap<u32, Option<Bitmap>>>,\n    distribution_type: DistributionType,\n    actor_count: u32,","sourceCodeStart":1058,"sourceCodeEnd":1094,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/meta/src/controller/scale.rs#L1058-L1094","documentation":"When assembling all_fragments grouped by database, render_actors_with_allocator looks up the database for the current job in streaming_job_databases. If the job has no database mapping in the loaded context, this error is returned with the job ID.","triggerScenarios":"render_actors_with_allocator is invoked with a job_id that exists in job_map/fragments but was absent from streaming_job_databases — e.g. the context was built by a code path that skipped the job-to-database mapping, or the job predates database scoping and its mapping was never backfilled.","commonSituations":"Upgrades from pre-multi-database versions with un-mapped legacy jobs; a caller constructing LoadedFragmentContext manually without filling streaming_job_databases; catalog rows missing the database association.","solutions":["Ensure streaming_job_databases is populated for every job before calling the renderer (use into_database_contexts, which derives it from the catalog).","Backfill the job's database mapping in the meta catalog for legacy jobs.","Rebuild the loaded context via the standard load_fragment_context / load_fragment_context_for_jobs entry points instead of hand-constructing it.","Retry after the upgrade/migration completes fully."],"exampleFix":"// before\nlet context = build_loaded_context(...);\nrender_actors_with_allocator(&context, ...);\n// after\nlet contexts = context.into_database_contexts(); // fills streaming_job_databases per database\nfor ctx in contexts.values() {\n    render_actors_with_allocator(ctx, ...)?;\n}","handlingStrategy":"validation","validationCode":"for job_id in ctx.job_map.keys() {\n    assert!(ctx.streaming_job_databases.contains_key(job_id),\n            \"job {job_id} has no database mapping\");\n}","typeGuard":"fn has_database_mapping(ctx: &LoadedFragmentContext, job_id: JobId) -> bool {\n    ctx.streaming_job_databases.contains_key(&job_id)\n}","tryCatchPattern":"let Some(&database_id) = ctx.streaming_job_databases.get(&job_id) else {\n    return Err(anyhow!(\"job {job_id} missing database mapping; rebuild context\"));\n};","preventionTips":["Construct contexts via into_database_contexts so mappings are derived from the catalog","Backfill database mappings for jobs created before multi-database support","Never hand-construct LoadedFragmentContext","Complete version migrations before rescaling"],"tags":["rescale","database","allocator","metadata"],"backgroundTag":"missing-config-key","analyzedSha":"6469eb736d691e8e9b8a419a57edd6429ca77417","analyzedAt":"2026-09-11T21:06:21.487Z","contentChangedAt":"2026-09-11T21:06:21.487Z","schemaVersion":2},"datasetVersion":"2026-09-14T21:17:11.552Z"}