{"record":{"id":"babb56a7ef6203c5","repo":"influxdata/influxdb","slug":"datafusion-error-0-http","errorCode":null,"errorMessage":"datafusion error: {0}","messagePattern":"datafusion error: (.+?)","errorType":"http","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"influxdb3_server/src/http.rs","lineNumber":314,"sourceCode":"    WriteBuffer(#[from] influxdb3_write::write_buffer::Error),\n\n    /// Persister error\n    #[error(\"persister error: {0}\")]\n    Persister(#[from] influxdb3_write::persister::PersisterError),\n\n    // ToStrError\n    #[error(\"to str error: {0}\")]\n    ToStr(#[from] hyper::header::ToStrError),\n\n    // SerdeJsonError\n    #[error(\"serde json error: {0}\")]\n    SerdeJson(#[from] serde_json::Error),\n\n    // Influxdb3 Write\n    #[error(\"serde json error: {0}\")]\n    Influxdb3Write(#[from] influxdb3_write::Error),\n\n    #[error(\"datafusion error: {0}\")]\n    Datafusion(#[from] DataFusionError),\n\n    #[error(\"io error: {0}\")]\n    Io(#[from] std::io::Error),\n\n    #[error(\"query error: {0}\")]\n    Query(#[from] QueryExecutorError),\n\n    #[error(transparent)]\n    DbName(#[from] ValidateDbNameError),\n\n    #[error(\"partial write of line protocol occurred\")]\n    PartialLpWrite(BufferedWriteRequest),\n\n    #[error(\"error in InfluxQL statement: {0}\")]\n    InfluxqlRewrite(#[from] rewrite::Error),\n\n    #[error(\"must provide only one InfluxQl statement per query\")]","sourceCodeStart":296,"sourceCodeEnd":332,"githubUrl":"https://github.com/influxdata/influxdb/blob/06200ef96ba82c5f6727e5038a83af8e722c6875/influxdb3_server/src/http.rs#L296-L332","documentation":"This variant wraps a DataFusionError that occurred while the HTTP API executed a query (SQL or InfluxQL) against the query engine. DataFusion is the underlying query engine of InfluxDB3, and any planning, parsing, or execution failure inside it surfaces here as `datafusion error: {0}`. It is a transparent wrapper: the inner DataFusion message carries the real diagnostic.","triggerScenarios":"Calling the /query or /api/v3/query_sql HTTP endpoints with SQL that fails to parse, references non-existent tables/columns, uses unsupported functions, or fails type coercion during DataFusion execution.","commonSituations":"Typo'd table or column names in SQL; querying a measurement with the wrong field type after a schema change; using DataFusion-incompatible syntax; querying before data was written.","solutions":["Read the inner DataFusion message after `datafusion error: ` for the actual cause (parse, column, or type error).","Verify table and column names against the server schema (e.g. SHOW TABLES / information_schema).","Validate the SQL syntax against DataFusion-supported SQL; simplify the query to isolate the failing clause.","Confirm field types have not changed; cast explicitly in SQL when mixing types."],"exampleFix":"// before\nSELECT tempature FROM home\n// after\nSELECT temperature FROM home","handlingStrategy":"try-catch","validationCode":"// validate SQL offline: check table/column names against information_schema before querying\nconst tables = await fetch(`${host}/api/v3/query_sql?q=SHOW TABLES`);","typeGuard":"function isDatafusionError(e: unknown): e is { message: string } {\n  return e instanceof Error && e.message.startsWith('datafusion error: ');\n}","tryCatchPattern":"try { await query(sql); } catch (e) { if (isDatafusionError(e)) log(e.message.replace('datafusion error: ', '')); else throw e; }","preventionTips":["Lint SQL against the server schema before deploying queries","Cast field types explicitly in SQL","Keep queries simple and split complex statements","Pin schema changes with explicit column types"],"tags":["datafusion","query","sql","http-api"],"backgroundTag":"database-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"}