{"record":{"id":"d09b8538de5f6ff9","repo":"influxdata/influxdb","slug":"must-provide-only-one-influxql-statement-per-query","errorCode":null,"errorMessage":"must provide only one InfluxQl statement per query","messagePattern":"must provide only one InfluxQl statement per query","errorType":"validation","errorClass":"Error::InfluxqlSingleStatement","httpStatus":null,"severity":"error","filePath":"core/iox_v1_query_api/src/error.rs","lineNumber":55,"sourceCode":"        message: &'static str,\n        error: String,\n    },\n\n    /// Serde decode error\n    #[error(\"error decoding params from url: {0}\")]\n    SerdeUrlDecoding(#[from] serde_urlencoded::de::Error),\n\n    // SerdeJsonError\n    #[error(\"error decoding query body: {0}\")]\n    SerdeJson(#[from] serde_json::Error),\n\n    #[error(\"datafusion error: {0}\")]\n    Datafusion(#[from] DataFusionError),\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(\n        \"provided a retention policy in both the parameters ({param_rp}) and \\\n        query string ({query_rp}) that do not match, if providing a query \\\n        that specifies the retention_policy, you can omit the 'rp' parameter \\\n        from your request\"","sourceCodeStart":37,"sourceCodeEnd":73,"githubUrl":"https://github.com/influxdata/influxdb/blob/06200ef96ba82c5f6727e5038a83af8e722c6875/core/iox_v1_query_api/src/error.rs#L37-L73","documentation":"The v1 query API accepts exactly one InfluxQL statement per request. When the request body contains multiple statements, this unit variant is thrown. It exists to keep the API surface simple and the response mapping unambiguous.","triggerScenarios":"POST to the v1 /query endpoint with a `q` parameter containing two or more statements separated by semicolons, e.g. `q=SELECT * FROM a; SELECT * FROM b`.","commonSituations":"Porting scripts from InfluxDB 1.x where multi-statement queries were allowed; copy-pasting multiple queries into one request; generated clients batching statements.","solutions":["Split the statements into separate /query requests.","Strip the trailing/inner semicolons so only one statement remains.","Update scripts or clients that batch multiple statements into one `q` value."],"exampleFix":"// before\nGET /query?q=SELECT+*+FROM+a;SELECT+*+FROM+b\n// after\nGET /query?q=SELECT+*+FROM+a\nGET /query?q=SELECT+*+FROM+b","handlingStrategy":"validation","validationCode":"function assertSingleStatement(q) {\n  const stmts = q.split(';').map(s => s.trim()).filter(Boolean);\n  if (stmts.length > 1) throw new Error(`expected 1 statement, got ${stmts.length}`);\n  return stmts[0] ?? '';\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Strip trailing semicolons from user-supplied query strings.","Never batch multiple statements into a single `q` parameter.","Write a unit test that rejects multi-statement payloads in client code."],"tags":["influxql","query","validation","api-request"],"backgroundTag":"invalid-query-parameter","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"}