{"record":{"id":"94f72739d8d6a497","repo":"influxdata/influxdb","slug":"error-in-influxql-statement-0-http","errorCode":null,"errorMessage":"error in InfluxQL statement: {0}","messagePattern":"error in InfluxQL statement: (.+?)","errorType":"http","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"influxdb3_server/src/http.rs","lineNumber":329,"sourceCode":"    #[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\")]\n    InfluxqlSingleStatement,\n\n    #[error(\"must specify a 'db' parameter, or provide the database in the InfluxQL query\")]\n    InfluxqlNoDatabase,\n\n    #[error(\n        \"provided a database in both the parameters ({param_db}) and \\\n        query string ({query_db}) that do not match, if providing a query \\\n        that specifies the database, you can omit the 'database' parameter \\\n        from your request\"\n    )]\n    InfluxqlDatabaseMismatch { param_db: String, query_db: String },\n\n    #[error(\"Operation with object store failed: {0}\")]\n    ObjectStore(#[from] object_store::Error),","sourceCodeStart":311,"sourceCodeEnd":347,"githubUrl":"https://github.com/influxdata/influxdb/blob/06200ef96ba82c5f6727e5038a83af8e722c6875/influxdb3_server/src/http.rs#L311-L347","documentation":"Wraps rewrite::Error raised while rewriting an InfluxQL statement into the internal query representation. InfluxQL (the InfluxDB 1.x query language) must be translated before execution, and statements using unsupported constructs fail here with `error in InfluxQL statement: {0}`.","triggerScenarios":"Sending an InfluxQL query via the /query (v1-compatibility) endpoint whose statement contains unsupported selectors, clauses, or functions that the rewriter cannot translate.","commonSituations":"Migrating from InfluxDB 1.x and reusing 1.x queries verbatim; using SHOW/GRANT/RETENTION statements not supported by the 3.x rewriter; exotic subqueries or continuous-query syntax.","solutions":["Read the inner rewrite error to see which statement/clause failed.","Rewrite the query using supported InfluxQL or convert it to SQL for the /api/v3/query_sql endpoint.","Check the InfluxDB 3.x InfluxQL support documentation for unsupported functions and clauses.","Split multi-clause or exotic queries into simpler supported statements."],"exampleFix":"// before\nSELECT moving_average(mean(value), 5) FROM cpu WHERE time > now() - 1h\n// after\n-- use a supported construct or SQL windowing\nSELECT mean(value) FROM cpu WHERE time > now() - 1h GROUP BY time(5m)","handlingStrategy":"validation","validationCode":"// check statement against the supported InfluxQL function/clause allowlist before sending\nif (!SUPPORTED_INFLUXQL_RE.test(q)) convertToSql(q);","typeGuard":null,"tryCatchPattern":"try { await influxqlQuery(q); } catch (e) { if (e.message.startsWith('error in InfluxQL statement')) return fallbackToSql(q); throw e; }","preventionTips":["Keep a supported-InfluxQL reference for your server version","Prefer SQL on /api/v3/query_sql for new work","Test migrated 1.x queries in staging first","Avoid 1.x-only meta statements (SHOW GRANTS, continuous queries)"],"tags":["influxql","query","rewrite"],"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"}