{"record":{"id":"ffe4cb1f3a609f5e","repo":"databendlabs/databend","slug":"internal-error-expect-txngetresponseget-of-get-da","errorCode":null,"errorMessage":"internal error: expect TxnGetResponseGet of get database meta by db_id, but got {:?}","messagePattern":"internal error: expect TxnGetResponseGet of get database meta by db_id, but got (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/meta/api/src/api_impl/garbage_collection_api.rs","lineNumber":462,"sourceCode":"        let mut new_db_meta = seq_db_meta;\n        new_db_meta.gc_in_progress = true;\n        let mut txn = TxnRequest::default();\n        txn_replace_exact(&mut txn, &dbid, new_db_meta.seq, &new_db_meta.data)?;\n        txn.if_then.push(txn_get(&dbid));\n        let (success, mut responses) = send_txn(kv_api, txn).await?;\n        if !success {\n            return Err(KVAppError::AppError(AppError::from(\n                MarkDatabaseMetaAsGCInProgressFailed::new(format!(\n                    \"Failed to mark database {}[{}] as gc_in_progress\",\n                    db_name, db_id\n                )),\n            )));\n        }\n\n        // Grab the sequence number of new database meta key value pair\n        let resp = responses.pop().unwrap();\n        let Some(Response::Get(get_resp)) = resp.response else {\n            unreachable!(\n                \"internal error: expect TxnGetResponseGet of get database meta by db_id, but got {:?}\",\n                resp.response\n            )\n        };\n        db_meta_seq = get_resp\n            .value\n            .expect(\"txn op response of get(&dbid) should have value\")\n            .seq\n    };\n\n    // Cleaning up DbIdTableName keys\n    {\n        let db_id_table_name = DBIdTableName {\n            db_id,\n            // Going to use 1 level DirName as list prefix, thus the table_name field does not matter\n            table_name: \"dummy\".to_string(),\n        };\n        let dir_name = DirName::new_with_level(db_id_table_name, 1);","sourceCodeStart":444,"sourceCodeEnd":480,"githubUrl":"https://github.com/databendlabs/databend/blob/288d84d76e20a2f8f7173bda9691eb6ece301aa9/src/meta/api/src/api_impl/garbage_collection_api.rs#L444-L480","documentation":"In gc_dropped_db_by_id, the code issues a transactional GET on the database meta kv pair and asserts the response is a Get response carrying the DB meta. If the meta-service returns any other response variant (e.g. an empty or unexpected Txn response), this unreachable!() fires with the offending response. It means the transaction API returned a shape the caller never expected for a plain get-by-id — an internal protocol/invariant violation rather than a missing-database error (that is handled earlier via the value being None).","triggerScenarios":"gc_dropped_db_by_id (invoked from gc_drop_tables) reading back the DB meta by id and receiving a non-Get response from the meta kv transaction — typically after a key-space/version mismatch or a malformed response from a meta node.","commonSituations":"Mixed-version databend-meta cluster where one node returns a newer/older response shape; a corrupted or partially migrated meta store for the dropped database id; proxying meta traffic through an incompatible node.","solutions":["Verify all meta nodes run the same databend version; rolling-upgrade mismatches can change txn response shapes","Check the meta store entry for the dropped db id for corruption or missing migration steps","Capture the full log of gc_drop_tables and report as a meta-service bug including the unexpected response variant","Restart/repair the meta cluster from a consistent snapshot if the store is inconsistent"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":"fn is_get_response(resp: &Response) -> bool { matches!(resp, Response::Get(_)) }","tryCatchPattern":"match resp.response { Response::Get(g) => process(g), other => { log::error!(\"unexpected txn response: {:?}\", other); retry_with_backoff(); } }","preventionTips":["Ensure all meta nodes run identical versions","Retry GC after transient meta-store errors","Inspect the dropped db's meta entries if panics repeat"],"tags":["rust","meta-service","garbage-collection","internal-invariant","protobuf"],"backgroundTag":"unexpected-response-shape","analyzedSha":"288d84d76e20a2f8f7173bda9691eb6ece301aa9","analyzedAt":"2026-09-11T11:29:36.208Z","contentChangedAt":"2026-09-11T11:29:36.208Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}