{"record":{"id":"1444d7b271a99610","repo":"influxdata/influxdb","slug":"db-name-did-not-start-with-a-number-or-letter","errorCode":null,"errorMessage":"db name did not start with a number or letter","messagePattern":"db name did not start with a number or letter","errorType":"validation","errorClass":"ValidateDbNameError","httpStatus":null,"severity":"error","filePath":"influxdb3_server/src/http.rs","lineNumber":2427,"sourceCode":"        return Err(ValidateDbNameError::InvalidRetentionPolicy);\n    }\n\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 => {","sourceCodeStart":2409,"sourceCodeEnd":2445,"githubUrl":"https://github.com/influxdata/influxdb/blob/06200ef96ba82c5f6727e5038a83af8e722c6875/influxdb3_server/src/http.rs#L2409-L2445","documentation":"Variant `InvalidStartChar` of `ValidateDbNameError` in influxdb3_server/src/http.rs. The database name's first character must be a letter or a number; names beginning with an underscore, hyphen, or other symbol are rejected during validation.","triggerScenarios":"Passing a db name starting with `_`, `-`, or another non-alphanumeric character, e.g. `db=_metrics` or `db=-temp`.","commonSituations":"Convention-style names with leading underscores copied from other systems (Prometheus-style `_meta`); generated names built by prefixing separators; template placeholders left unresolved (`{{db}}`).","solutions":["Ensure the name starts with an ASCII letter or digit (e.g. `metrics_tmp` instead of `_metrics`)","Apply a client-side check like `/^[a-zA-Z0-9][a-zA-Z0-9_-]*$/` before sending","Strip leading separators when generating names from templates"],"exampleFix":"// before\nlet db = \"_metrics\";\n// after\nlet db = \"metrics\"; // must start with a letter or number","handlingStrategy":"validation","validationCode":"function validateDbStart(db) {\n  if (!/^[a-zA-Z0-9]/.test(db)) throw new Error(`db name must start with a letter or number: '${db}'`);\n}","typeGuard":"const startsAlphanumeric = (db) => typeof db === 'string' && /^[a-zA-Z0-9]/.test(db);","tryCatchPattern":"try {\n  return await api.write(db, data);\n} catch (e) {\n  if (String(e.message).includes('did not start with a number or letter')) {\n    throw new ValidationError(`rename '${db}' to start with a letter/digit`);\n  }\n  throw e;\n}","preventionTips":["Generate names beginning with a letter/digit; replace leading underscores/hyphens","Check templated names for unresolved placeholders before sending"],"tags":["database","naming","validation","write-api"],"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"}