{"record":{"id":"4b8656d85a3d0b9c","repo":"influxdata/influxdb","slug":"datafusion-error-0-lib","errorCode":null,"errorMessage":"datafusion error: {0}","messagePattern":"datafusion error: (.+?)","errorType":"error_code","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"influxdb3_server/src/lib.rs","lineNumber":72,"sourceCode":"\npub const PRODUCT_NAME: &str = \"InfluxDB 3 Core\";\npub const INFLUXDB3_BUILD: &str = \"Core\";\n\n/// Version string combining the product name, [`influxdb3_process::INFLUXDB3_VERSION`], and [`influxdb3_process::INFLUXDB3_GIT_HASH`].\npub static VERSION_STRING: LazyLock<String> = LazyLock::new(|| build_version_string(PRODUCT_NAME));\n\n#[derive(Debug, Error)]\npub enum Error {\n    #[error(\"hyper error: {0}\")]\n    Hyper(#[from] hyper::Error),\n\n    #[error(\"http error: {0}\")]\n    Http(#[from] Box<http::Error>),\n\n    #[error(\"database not found {db_name}\")]\n    DatabaseNotFound { db_name: String },\n\n    #[error(\"datafusion error: {0}\")]\n    DataFusion(#[from] datafusion::error::DataFusionError),\n\n    #[error(\"influxdb3_write error: {0}\")]\n    InfluxDB3Write(#[from] influxdb3_write::Error),\n\n    #[error(\"from hex error: {0}\")]\n    FromHex(#[from] hex::FromHexError),\n\n    #[error(\"io error: {0}\")]\n    Io(#[from] std::io::Error),\n\n    #[error(\"tls config error: {0}\")]\n    TlsConfig(String),\n\n    #[error(\"rustls error: {0}\")]\n    Rustls(#[from] rustls::Error),\n}\n","sourceCodeStart":54,"sourceCodeEnd":90,"githubUrl":"https://github.com/influxdata/influxdb/blob/06200ef96ba82c5f6727e5038a83af8e722c6875/influxdb3_server/src/lib.rs#L54-L90","documentation":"The DataFusion variant of influxdb3_server::Error, wrapping a datafusion::error::DataFusionError via #[from]. It means query planning or execution in the DataFusion engine failed — SQL parse/plan errors, missing tables/columns, type mismatches, or execution failures.","triggerScenarios":"Submitting SQL with a syntax error; querying a table (measurement) or column that does not exist; type-incompatible comparisons (e.g. comparing a string column to an int); resource/execution errors during a streaming query plan.","commonSituations":"Hand-written or generated SQL with typos; schema drift after measurement/tag changes; porting queries from InfluxQL/other SQL dialects with unsupported functions; querying a time column with the wrong literal type.","solutions":["Read the wrapped DataFusionError text — it names the parse/plan/execution failure precisely","Run the query with corrected syntax against SHOW TABLES / schema info to confirm table and column names","Cast literals/columns to matching types (e.g. use a proper timestamp literal) and remove unsupported functions"],"exampleFix":"// before\nSELECT * FROM cpu WHERE time > '2024-01-01'  -- string vs timestamp type mismatch\n// after\nSELECT * FROM cpu\nWHERE time > TIMESTAMP '2024-01-01T00:00:00Z';","handlingStrategy":"try-catch","validationCode":"// Verify objects exist before querying\nlet tables = client.show_tables(db)?;\nanyhow::ensure!(tables.contains(&\"cpu\".to_string()), \"table 'cpu' missing\");","typeGuard":null,"tryCatchPattern":"match err {\n    ServerError::DataFusion(df_err)\n        if matches!(df_err, DataFusionError::Plan(_) | DataFusionError::SQL(_, _)) =>\n    {\n        // static SQL problem: fix the query text; retrying won't help\n    }\n    ServerError::DataFusion(df_err) => {\n        // execution failure: log, optionally retry with backoff\n    }\n    _ => return Err(err),\n}","preventionTips":["Check table/column names against SHOW TABLES / schema endpoints before querying","Use typed query builders or parameterized queries to avoid literal type mismatches","Test generated SQL against the actual InfluxDB 3 dialect, especially when porting from other systems"],"tags":["sql","query","datafusion"],"backgroundTag":"sql-query-failed","analyzedSha":"06200ef96ba82c5f6727e5038a83af8e722c6875","analyzedAt":"2026-09-19T12:55:30.003Z","contentChangedAt":"2026-09-19T12:55:30.003Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}