{"record":{"id":"881d29e8b5b42a7b","repo":"databendlabs/databend","slug":"internal-error-entered-unreachable-code-881d29","errorCode":null,"errorMessage":"internal error: entered unreachable code","messagePattern":"internal error: entered unreachable code","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/query/storages/common/index/src/filters/xor8/xor8_filter.rs","lineNumber":176,"sourceCode":"    }\n}\n\nimpl Index for Xor8Filter {\n    fn supported_type(data_type: &DataType) -> bool {\n        let inner_type = data_type.remove_nullable();\n        if let DataType::Map(box inner_ty) = inner_type {\n            match inner_ty {\n                DataType::Tuple(kv_tys) => {\n                    return matches!(\n                        kv_tys[1].remove_nullable(),\n                        DataType::Number(_)\n                            | DataType::String\n                            | DataType::Variant\n                            | DataType::Timestamp\n                            | DataType::Date\n                    );\n                }\n                _ => unreachable!(),\n            };\n        }\n        matches!(\n            inner_type,\n            DataType::Number(_) | DataType::String | DataType::Timestamp | DataType::Date\n        )\n    }\n}\n\nimpl Xor8CodecError {\n    pub fn new(msg: impl Display, cause: &(impl std::error::Error + 'static)) -> Self {\n        Self {\n            msg: msg.to_string(),\n            cause: AnyError::new(cause),\n        }\n    }\n}\n","sourceCodeStart":158,"sourceCodeEnd":194,"githubUrl":"https://github.com/databendlabs/databend/blob/288d84d76e20a2f8f7173bda9691eb6ece301aa9/src/query/storages/common/index/src/filters/xor8/xor8_filter.rs#L158-L194","documentation":"`Xor8Filter::supported_type` checks whether an xor8 bloom (nbf) index supports a column type. For Map types, the inner type is always assumed to be Tuple(k,v); a Map whose inner type is anything else reaches `_ => unreachable!()`, panicking with internal error 1001.","triggerScenarios":"Declaring a bloom index (nbf/bloom filter index) on a MAP column whose inner type metadata is not Tuple — for example Map over a non-tuple type due to schema corruption or an engine-level type change.","commonSituations":"CREATE TABLE/ALTER with index definitions on maps under a mismatched schema; migrations between Databend versions where map representation changed.","solutions":["Fix the column schema so the map inner type is Tuple(String, T), or recreate the table and migrate data","Remove the bloom index definition for the malformed map column","Report as a bug: supported_type should return false for unexpected inner types rather than panic"],"exampleFix":"// before\n_ => unreachable!(),\n// after\n_ => return false,\n// or: other => { tracing::warn!(\"unsupported map inner {:?}\", other); false }","handlingStrategy":"validation","validationCode":"-- before declaring an nbf/bloom index on a map column:\nDESC <table>;\n-- require type to match MAP(TUPLE(String, Supported))","typeGuard":null,"tryCatchPattern":"try {\n  createIndex(indexDef);\n} catch (e) {\n  if (e.code === 1001 && /xor8|bloom/.test(e.message)) {\n    // remove the index option for that column and recreate\n  }\n}","preventionTips":["Only declare bloom (nbf) indexes on supported types (numbers, strings, timestamps, dates, standard maps)","Verify map inner types after any schema migration","Remove index definitions for columns whose types changed"],"tags":["rust","bloom-index","xor8","internal-error","map"],"backgroundTag":"internal-invariant-violation","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"}