influxdata/influxdb · error · Error
error validating database name
Error message
error validating database name: {0} What it means
This error wraps DatabaseNameError raised while validating a database name supplied to the InfluxDB 3 HTTP API. The server enforces naming rules (charset, length, reserved characters) before any data operation touches the database, and if the name fails that validation the request is rejected with this message including the underlying reason. It is surfaced as a thiserror variant converted automatically from DatabaseNameError via #[from].
Solutions
- Print the embedded cause ({0}) to see which naming rule was violated and correct the database name accordingly.
- Sanitize the database name: use only letters, digits, underscores, and hyphens; keep it short and non-empty.
- Check the `db` query parameter in the request URL for truncation or unencoded special characters; URL-encode if needed.
- If names come from user input, validate them client-side with the same rules before calling the API.
Example fix
// before
let url = format!("http://localhost:8181/api/v3/write_lp?db=my db #1");
// after
let db = "my_db_1"; // sanitized: no spaces or '#'
let url = format!("http://localhost:8181/api/v3/write_lp?db={db}"); Defensive patterns
Strategy: validation
Validate before calling
fn is_valid_db_name(name: &str) -> bool {
!name.is_empty()
&& name.len() <= 64
&& name.chars().all(|c| c.is_ascii_alphanumeric() || c == '_' || c == '-')
} Prevention
- Validate database names against the documented charset/length rules before every API call.
- Never pass raw user input or file names as database names; sanitize first.
- URL-encode the db parameter in hand-built URLs.
When it happens
Trigger: Calling POST /api/v3/write_lp, /write, or any endpoint with a `db` query parameter whose value violates database naming rules (e.g. contains invalid characters, is too long, is empty, or uses reserved names).
Common situations: Typos in connection strings or DSNs; programmatic database names generated from user input, file names, or UUIDs containing disallowed characters; migration from other systems that permit looser names; empty `db` parameter after template-variable substitution fails.
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
- cannot use a column of type
- failed to parse line protocol
- incoming write was empty
- invalid database name
- invalid node name ( )
AI-assisted analysis of influxdata/influxdb@06200ef96b (2026-09-19).
Data as JSON: /api/errors/589e080a7599e990.
Report an issue: GitHub.
Appendix: source
Thrown at influxdb3_server/src/http.rs:235
InvalidContentType { expected: mime::Mime },
/// The client disconnected.
#[error("client disconnected")]
ClientHangup(Box<dyn std::error::Error + Send + Sync>),
/// The client sent a request body that exceeds the configured maximum.
#[error("max request size ({0} bytes) exceeded")]
RequestSizeExceeded(usize),
/// Decoding a gzip-compressed stream of data failed.
#[error("error decoding gzip stream: {0}")]
InvalidGzip(std::io::Error),
#[error("invalid mime type ({0})")]
InvalidMimeType(String),
/// DatabaseName validation error.
#[error("error validating database name: {0}")]
InvalidDatabaseName(#[from] DatabaseNameError),
/// Failure to decode the provided line protocol.
#[error("failed to parse line protocol: {0}")]
ParseLineProtocol(influxdb_line_protocol::Error),
/// The router is currently servicing the maximum permitted number of
/// simultaneous requests.
#[error("this service is overloaded, please try again later")]
RequestLimit,
/// The request has no authentication, but authorization is configured.
#[error("authentication required")]
Unauthenticated,
/// The provided authorization is not sufficient to perform the request.
#[error("access denied")]
Forbidden,View on GitHub (pinned to 06200ef96b)