{"record":{"id":"bd2726de4dff7478","repo":"influxdata/influxdb","slug":"db-name-with-invalid-retention-policy-if-providing-a","errorCode":null,"errorMessage":"db name with invalid retention policy, if providing a retention policy name, must be of form '<db_name>/<rp_name>'","messagePattern":"db name with invalid retention policy, if providing a retention policy name, must be of form '<db_name>/<rp_name>'","errorType":"validation","errorClass":"ValidateDbNameError","httpStatus":null,"severity":"error","filePath":"influxdb3_server/src/http.rs","lineNumber":2429,"sourceCode":"\n    Ok(())\n}\n\n// v1 supports 255 chars for the database name and 255 chars for the\n// retention policy name; we support those combined with a forward slash so\n// 255*2+1.\nconst MAXIMUM_DATABASE_NAME_LENGTH: usize = 511;\n\n#[derive(Clone, Copy, Debug, thiserror::Error)]\npub enum ValidateDbNameError {\n    #[error(\n        \"invalid character in database or rp name: must be ASCII, \\\n        containing only letters, numbers, underscores, or hyphens\"\n    )]\n    InvalidChar,\n    #[error(\"db name did not start with a number or letter\")]\n    InvalidStartChar,\n    #[error(\n        \"db name with invalid retention policy, if providing a \\\n        retention policy name, must be of form '<db_name>/<rp_name>'\"\n    )]\n    InvalidRetentionPolicy,\n    #[error(\"db name cannot be empty\")]\n    Empty,\n    #[error(\"db name too long: max {}\", MAXIMUM_DATABASE_NAME_LENGTH)]\n    NameTooLong,\n}\n\nasync fn record_batch_stream_to_body(\n    mut stream: Pin<Box<dyn RecordBatchStream + Send>>,\n    format: QueryFormat,\n) -> Result<ResponseBody, Error> {\n    match format {\n        QueryFormat::Pretty => {\n            let batches = stream.try_collect::<Vec<RecordBatch>>().await?;\n            Ok(bytes_to_response_body(Bytes::from(format!(","sourceCodeStart":2411,"sourceCodeEnd":2447,"githubUrl":"https://github.com/influxdata/influxdb/blob/06200ef96ba82c5f6727e5038a83af8e722c6875/influxdb3_server/src/http.rs#L2411-L2447","documentation":"Variant `InvalidRetentionPolicy` of `ValidateDbNameError` in influxdb3_server/src/http.rs. When a name includes a retention policy it must be split with a forward slash as `<db_name>/<rp_name>`; any other separator or structure (multiple slashes, dots, empty rp) is rejected.","triggerScenarios":"Passing `db=mydb.rp` (dot notation), `db=mydb//rp`, or a db/rp string that does not match the single-slash form to the write/query endpoints.","commonSituations":"Migrating from InfluxDB 1.x where `db.rp` dot notation was used; copy-pasted DSN strings; programmatic concatenation that inserts the wrong delimiter.","solutions":["Use the forward-slash form: `db=mydb/autogen` instead of `db=mydb.autogen`","Ensure exactly one slash separates db and rp, and neither part is empty","Update migration scripts/clients from InfluxDB 1.x dot notation to slash notation"],"exampleFix":"// before\ncurl 'host/api/v3/write?db=mydb.autogen' --data 'm v=1'\n// after\ncurl 'host/api/v3/write?db=mydb/autogen' --data 'm v=1'","handlingStrategy":"validation","validationCode":"function validateDbRp(name) {\n  if (name.includes('/') && !/^[^/]+\\/[^/]+$/.test(name)) {\n    throw new Error(\"use form '<db_name>/<rp_name>' with a single slash\");\n  }\n}","typeGuard":"const isDbRpForm = (n) => typeof n === 'string' && /^[^/]+\\/[^/]+$/.test(n);","tryCatchPattern":"try {\n  return await api.write(dbRp, data);\n} catch (e) {\n  if (String(e.message).includes('invalid retention policy')) {\n    throw new ValidationError(`convert to <db>/<rp> form: '${dbRp}'`);\n  }\n  throw e;\n}","preventionTips":["Convert InfluxDB 1.x 'db.rp' dot notation to 'db/rp' when migrating","Join db and rp with exactly one forward slash in code generators"],"tags":["database","retention-policy","naming","validation"],"backgroundTag":"invalid-identifier-format","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"}