influxdata/influxdb · error · ValidateDbNameError
db name too long: max
Error message
db name too long: max {} What it means
This error comes from the write path's database-name validation enum in influxdb3_server: the supplied database name exceeds MAXIMUM_DATABASE_NAME_LENGTH characters. InfluxDB enforces a hard cap on database (bucket) identifier length when validating names before creating or writing to a database. The request is rejected before any data is stored.
Solutions
- Shorten the database name to be at most MAXIMUM_DATABASE_NAME_LENGTH characters (use a hash or abbreviation of the intended name)
- Validate the name length client-side before issuing the write/create call
- If the name must encode more information, move the extra detail into tags/fields rather than the db name
Example fix
// before
let db = format!("{}_{}_{}", tenant, env, hostname); // may exceed limit
client.write_lp(db, &line_protocol).await?;
// after
const MAX_DB_NAME: usize = 64;
let db = format!("{}_{}", tenant, env);
assert!(db.len() <= MAX_DB_NAME, "db name too long");
client.write_lp(db, &line_protocol).await?; Defensive patterns
Strategy: validation
Validate before calling
const MAX_DB_NAME: usize = 64; // matches MAXIMUM_DATABASE_NAME_LENGTH
if db_name.is_empty() || db_name.len() > MAX_DB_NAME {
return Err(format!("db name must be 1..={} chars", MAX_DB_NAME));
} Prevention
- Check name length before every create/write call
- Derive names from fixed prefixes plus short hashes, not raw hostnames or full UUIDs
- Keep db names in a shared constant/config so all environments use validated names
When it happens
Trigger: Calling the InfluxDB 3 write API (e.g. POST /api/v3/write_lp or /write) with a `db` parameter longer than the maximum allowed length; programmatic database creation where a name is derived from user input or a long hostname/UUID without length checks.
Common situations: Auto-generating database names from UUIDs, hostnames, or concatenating tenant+environment prefixes; misconfigured SDK defaults that append long suffixes; migrating from systems with laxer naming limits.
Understand the failure class
Background: "invalid id" errors: invalid identifier format — why libraries reject IDs before lookup, and how to fix them — this error's family across 37 libraries.
Related errors
- db name cannot be empty
- db name did not start with a number or letter
- db name with invalid retention policy, if providing a…
- invalid character in database or rp name: must be ASCII…
- database name ' ' contains invalid character, character…
AI-assisted analysis of influxdata/influxdb@06200ef96b (2026-09-19).
Data as JSON: /api/errors/ac3ea9785b00f2e5.
Report an issue: GitHub.
Appendix: source
Thrown at influxdb3_server/src/http.rs:2436
const MAXIMUM_DATABASE_NAME_LENGTH: usize = 511;
#[derive(Clone, Copy, Debug, thiserror::Error)]
pub enum ValidateDbNameError {
#[error(
"invalid character in database or rp name: must be ASCII, \
containing only letters, numbers, underscores, or hyphens"
)]
InvalidChar,
#[error("db name did not start with a number or letter")]
InvalidStartChar,
#[error(
"db name with invalid retention policy, if providing a \
retention policy name, must be of form '<db_name>/<rp_name>'"
)]
InvalidRetentionPolicy,
#[error("db name cannot be empty")]
Empty,
#[error("db name too long: max {}", MAXIMUM_DATABASE_NAME_LENGTH)]
NameTooLong,
}
async fn record_batch_stream_to_body(
mut stream: Pin<Box<dyn RecordBatchStream + Send>>,
format: QueryFormat,
) -> Result<ResponseBody, Error> {
match format {
QueryFormat::Pretty => {
let batches = stream.try_collect::<Vec<RecordBatch>>().await?;
Ok(bytes_to_response_body(Bytes::from(format!(
"{}",
pretty::pretty_format_batches(&batches)?
))))
}
QueryFormat::Parquet => {
// Grab the first batch so that we can get the schema
let Some(batch) = stream.next().await.transpose()? else {View on GitHub (pinned to 06200ef96b)