databendlabs/databend · error
internal error: entered unreachable code
Error message
internal error: entered unreachable code
What it means
`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.
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
Example fix
// before
_ => unreachable!(),
// after
_ => return false,
// or: other => { tracing::warn!("unsupported map inner {:?}", other); false } Defensive patterns
Strategy: validation
Validate before calling
-- before declaring an nbf/bloom index on a map column: DESC <table>; -- require type to match MAP(TUPLE(String, Supported))
Try / catch
try {
createIndex(indexDef);
} catch (e) {
if (e.code === 1001 && /xor8|bloom/.test(e.message)) {
// remove the index option for that column and recreate
}
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: CREATE TABLE/ALTER with index definitions on maps under a mismatched schema; migrations between Databend versions where map representation changed.
Understand the failure class
Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.
Related errors
- internal error: entered unreachable code
- internal error: entered unreachable code
- internal error: entered unreachable code
- invalid map type
- internal error: entered unreachable code
AI-assisted analysis of databendlabs/databend@288d84d76e (2026-09-11).
Data as JSON: /api/errors/881d29e8b5b42a7b.
Report an issue: GitHub.
Appendix: source
Thrown at src/query/storages/common/index/src/filters/xor8/xor8_filter.rs:176
}
}
impl Index for Xor8Filter {
fn supported_type(data_type: &DataType) -> bool {
let inner_type = data_type.remove_nullable();
if let DataType::Map(box inner_ty) = inner_type {
match inner_ty {
DataType::Tuple(kv_tys) => {
return matches!(
kv_tys[1].remove_nullable(),
DataType::Number(_)
| DataType::String
| DataType::Variant
| DataType::Timestamp
| DataType::Date
);
}
_ => unreachable!(),
};
}
matches!(
inner_type,
DataType::Number(_) | DataType::String | DataType::Timestamp | DataType::Date
)
}
}
impl Xor8CodecError {
pub fn new(msg: impl Display, cause: &(impl std::error::Error + 'static)) -> Self {
Self {
msg: msg.to_string(),
cause: AnyError::new(cause),
}
}
}
View on GitHub (pinned to 288d84d76e)