{"record":{"id":"23e6be8526b58e56","repo":"influxdata/influxdb","slug":"provided-a-retention-policy-in-both-the-parameters-param-rp","errorCode":null,"errorMessage":"provided a retention policy in both the parameters ({param_rp}) and query string ({query_rp}) that do not match, if providing a query that specifies the retention_policy, you can omit the 'rp' parameter from your request","messagePattern":"provided a retention policy in both the parameters \\((.+?)\\) and query string \\((.+?)\\) that do not match, if providing a query that specifies the retention_policy, you can omit the 'rp' parameter from your request","errorType":"validation","errorClass":"Error::InfluxqlRetentionPolicyMismatch","httpStatus":null,"severity":"error","filePath":"core/iox_v1_query_api/src/error.rs","lineNumber":69,"sourceCode":"\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\"\n    )]\n    InfluxqlRetentionPolicyMismatch { param_rp: String, query_rp: String },\n\n    #[error(\"error reading field from body: {name} -- {error}\")]\n    FieldRead { name: &'static str, error: String },\n\n    #[error(\"Cannot retrieve database: {0}\")]\n    Database(DataFusionError),\n\n    #[error(\"Database {0} not found\")]\n    DatabaseNotFound(String),\n\n    #[error(\"v1 query API error: {0}\")]\n    V1Query(#[from] QueryError),","sourceCodeStart":51,"sourceCodeEnd":87,"githubUrl":"https://github.com/influxdata/influxdb/blob/06200ef96ba82c5f6727e5038a83af8e722c6875/core/iox_v1_query_api/src/error.rs#L51-L87","documentation":"Thrown when a retention policy is provided both in the request parameter (`rp`) and inside the query string, and the two values differ. Like the database mismatch case, the API rejects the request instead of guessing. The message includes both `param_rp` and `query_rp` values.","triggerScenarios":"GET/POST to the v1 /query endpoint with `rp=autogen` and a query qualified with a different retention policy, e.g. `?db=mydb&rp=autogen&q=SELECT * FROM \"mydb\".\"downsampled\".cpu`.","commonSituations":"Clients with a default `rp` setting while queries are hand-written with another RP; environment drift between staging and production retention policies; templated queries overriding the connection-level rp.","solutions":["Make the `rp` parameter and the query retention policy identical.","Remove the `rp` parameter when the query already qualifies the retention policy.","Update the client/datasource default `rp` to match the queries being issued."],"exampleFix":"// before\nGET /query?db=mydb&rp=autogen&q=SELECT+*+FROM+\"mydb\".\"downsampled\".cpu\n// after\nGET /query?db=mydb&rp=downsampled&q=SELECT+*+FROM+\"mydb\".\"downsampled\".cpu","handlingStrategy":"validation","validationCode":"function assertRpConsistent(rpParam, q) {\n  const m = /FROM\\s+\"[\\w-]+\"\\s*\\.\\s*\"([\\w-]+)\"\\s*\\./.exec(q);\n  if (rpParam && m && m[1] !== rpParam) {\n    throw new Error(`rp mismatch: param=${rpParam} query=${m[1]}`);\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use a single client-level default retention policy instead of per-query overrides.","Keep `rp` settings aligned across environments (staging/production).","Prefer the `rp` parameter and use unqualified measurement names in queries."],"tags":["influxql","query","conflict","retention-policy"],"backgroundTag":"conflicting-config-options","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"}