{"record":{"id":"ff9540aeb5c25c96","repo":"risingwavelabs/risingwave","slug":"database-not-found-when-resolving-reschedule-in","errorCode":null,"errorMessage":"database {} not found when resolving reschedule intent","messagePattern":"database (.+?) not found when resolving reschedule intent","errorType":"error_code","errorClass":"MetaError","httpStatus":null,"severity":"error","filePath":"src/meta/src/barrier/worker.rs","lineNumber":219,"sourceCode":"                        reschedule_plan: Some(reschedule_plan),\n                    },\n                    notifier,\n                ));\n                return Ok(Some(new_barrier));\n            }\n            let span = tracing::info_span!(\n                \"resolve_reschedule_intent\",\n                database_id = %new_barrier.database_id\n            );\n            let reschedule_plan = {\n                let _guard = span.enter();\n                build_reschedule_from_context(\n                    &env,\n                    worker_nodes,\n                    new_barrier.database_id,\n                    context,\n                    database_info.ok_or_else(|| {\n                        anyhow!(\n                            \"database {} not found when resolving reschedule intent\",\n                            new_barrier.database_id\n                        )\n                    })?,\n                )\n            };\n            match reschedule_plan {\n                Ok(Some(reschedule_plan)) => {\n                    new_barrier.command = Some((\n                        Command::RescheduleIntent {\n                            context: RescheduleContext::empty(),\n                            reschedule_plan: Some(reschedule_plan),\n                        },\n                        notifier,\n                    ));\n                    Ok(Some(new_barrier))\n                }\n                Ok(None) => {","sourceCodeStart":201,"sourceCodeEnd":237,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/meta/src/barrier/worker.rs#L201-L237","documentation":"resolve_reschedule_intent needs the in-flight database info to build a reschedule plan from a barrier context. If the catalog has no record of the barrier's database_id, it fails with `database <id> not found when resolving reschedule intent`, refusing to construct a plan against unknown database state.","triggerScenarios":"A BarrierManagerRequest carrying a database_id arrives while that database no longer exists in the catalog (dropped concurrently, or catalog state lagging), so `database_info` lookup returns None; the test test_reschedule_intent_without_workers_notifies_start_failed exercises this path.","commonSituations":"Race between `DROP DATABASE` and in-flight barrier/reschedule requests; stale client sessions referencing a deleted database; catalog recovery leaving the worker with pre-drop requests queued.","solutions":["Verify the database exists: `SHOW DATABASES;` — recreate it if it was dropped unintentionally.","Restart the client/session so it resolves current catalog state instead of a stale database id.","If this follows a DROP, drain or restart the affected sessions; recovery will clear stale queued requests.","If the database exists but lookup fails, run recovery to rebuild in-flight database info from the catalog."],"exampleFix":"// before: using a cached database id across a drop\nlet db_id = session.cached_database_id();\nworker.resolve_reschedule_intent(barrier_with(db_id)).await?;\n// after: re-resolve the id from the catalog first\nlet db_id = catalog.lookup_database_id(session.database_name()).await\n    .context(\"database no longer exists; recreate it\")?;","handlingStrategy":"validation","validationCode":"-- confirm the database still exists before relying on a cached id\nSHOW DATABASES;\n-- or in code: catalog.lookup_database_id(name).await? before issuing requests","typeGuard":"fn database_known(info: &Option<InflightDatabaseInfo>) -> bool {\n    info.is_some()\n}","tryCatchPattern":"match err {\n    e if e.to_string().contains(\"not found when resolving reschedule intent\") => {\n        // refresh session catalog state, reconnect, or recreate the database\n    }\n    e => return Err(e.into()),\n}","preventionTips":["Avoid long-lived sessions that cache database ids across DDL.","Re-resolve database names to ids after any DROP/CREATE cycle.","Run recovery after catalog-affecting failures so in-flight info matches the catalog."],"tags":["meta","database","catalog","not-found"],"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"}