{"record":{"id":"152b3e5fe15570af","repo":"databendlabs/databend","slug":"internal-error-entered-unreachable-code-152b3e","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/fuse/src/io/read/block/parquet/mod.rs","lineNumber":206,"sourceCode":"        Projection::InnerColumns(path_indices) => {\n            let mut name_paths = Vec::with_capacity(path_indices.len());\n            for index_path in path_indices.values() {\n                let mut name_path = Vec::with_capacity(index_path.len());\n                let first_index = index_path[0];\n                name_path.push(schema.fields[first_index].name().to_string());\n                let mut idx = 1;\n                let mut ty = schema.fields[first_index].data_type().clone();\n                while idx < index_path.len() {\n                    match ty.remove_nullable() {\n                        TableDataType::Tuple {\n                            fields_name,\n                            fields_type,\n                        } => {\n                            let next_index = index_path[idx];\n                            name_path.push(fields_name[next_index].clone());\n                            ty = fields_type[next_index].clone();\n                        }\n                        _ => unreachable!(),\n                    }\n                    idx += 1;\n                }\n                name_paths.push(name_path);\n            }\n            name_paths\n        }\n    }\n}\n","sourceCodeStart":188,"sourceCodeEnd":216,"githubUrl":"https://github.com/databendlabs/databend/blob/288d84d76e20a2f8f7173bda9691eb6ece301aa9/src/query/storages/fuse/src/io/read/block/parquet/mod.rs#L188-L216","documentation":"While building nested column name paths for deserializing parquet chunks (used by virtual columns / nested data), the code walks a type tree and expects every step to be a nested struct/fields node; any other DataType at an intermediate step hits unreachable!. Means the recorded index path does not match the actual type tree of the block schema.","triggerScenarios":"deserialize_parquet_columns walks a virtual-column index path into a schema where a step resolves to a non-nested type (e.g. leaf instead of Tuple/struct fields) — schema/type mismatch between stored virtual column info and current schema.","commonSituations":"Tables with virtual columns whose schema changed (ALTER dropping/renesting columns); segments written before/after a schema change; hand-edited or legacy virtual column metadata.","solutions":["Refresh virtual column metadata for the affected table (drop and recompute virtual columns)","Verify the table schema matches the schema recorded in the segment; restore schema from a snapshot if it drifted","Retry with virtual columns disabled to isolate the issue","File a bug with the table schema and segment info if it happens on an unmodified table"],"exampleFix":"// before\n_ => unreachable!(),\n// after\nother => {\n    return Err(ErrorCode::StorageOther(format!(\n        \"unexpected type {other:?} while resolving column name path at index {idx}\"\n    )));\n}","handlingStrategy":"validation","validationCode":"// rust: verify index path matches nested schema before deserialization\nfn path_matches_schema(schema: &DataType, path: &[usize]) -> bool {\n    let mut ty = schema;\n    for i in path {\n        match ty {\n            DataType::Tuple(fields) if *i < fields.len() => ty = &fields[*i],\n            _ => return false,\n        }\n    }\n    true\n}","typeGuard":"fn is_nested_at(ty: &DataType, idx: usize) -> bool {\n    matches!(ty, DataType::Tuple(fields) if idx < fields.len())\n}","tryCatchPattern":null,"preventionTips":["Recompute virtual column metadata after any ALTER that changes nested column structure","Validate stored index paths against the current schema at load time","Disable virtual columns when diagnosing schema-drift issues"],"tags":["rust","panic","unreachable","parquet","virtual-column"],"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"}