influxdata/influxdb · error · NewRoleDescriptionError
role description contains invalid characters: only…
Error message
role description contains invalid characters: only alphanumeric and [{0}] are allowed What it means
NewRoleDescriptionError::InvalidCharacters is returned when a role description contains characters outside the allowed set (alphanumeric plus those listed via format_allowed_chars). This keeps descriptions safe for storage and display.
Solutions
- Restrict the description to alphanumeric characters and the allowed punctuation shown in the error message
- Sanitize input by stripping or replacing disallowed characters before submission
- Validate client-side with the same allowlist regex used by the library
Example fix
// before
let desc = "read <all> data \u{1F680}"; // contains disallowed chars
// after
let desc = "read all data"; Defensive patterns
Strategy: validation
Validate before calling
fn valid_role_description_chars(desc: &str) -> bool {
// match the allowlist used by NewRoleDescriptionError (alphanumeric + allowed punctuation)
desc.chars().all(|c| c.is_ascii_alphanumeric() || c == '-' || c == '_' || c == ' ' || c == '.')
} Type guard
fn sanitize_role_description(raw: &str) -> String {
raw.chars().filter(|c| c.is_ascii_alphanumeric() || matches!(c, '-' | '_' | ' ' | '.')).collect()
} Prevention
- Strip rich-text/HTML artifacts before submitting descriptions
- Avoid emoji and non-ASCII characters in role metadata
- Mirror the library's allowlist in client-side validation
When it happens
Trigger: Providing a description with disallowed symbols or control/non-ASCII characters when creating or updating a role.
Common situations: Descriptions pasted from rich-text editors or containing angle brackets, quotes, or emoji that fail the allowlist.
Understand the failure class
Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
Related errors
- role description cannot be empty
- role description exceeds maximum length of
- role name contains invalid characters: only alphanumeric and
- role name exceeds maximum length of
- All `DataPoints` must have at least one field. Builder…
AI-assisted analysis of influxdata/influxdb@06200ef96b (2026-09-19).
Data as JSON: /api/errors/fbc060bbfa5711ba.
Report an issue: GitHub.
Appendix: source
Thrown at influxdb3_authz/src/role/role.rs:140
Ok(Self(description.to_string()))
}
pub fn into_inner(self) -> String {
self.0
}
pub fn new_unchecked(description: String) -> Self {
Self(description)
}
}
#[derive(Debug, Clone, Error)]
pub enum NewRoleDescriptionError {
#[error("role description cannot be empty")]
Empty,
#[error("role description exceeds maximum length of {ROLE_DESCRIPTION_MAX_LENGTH} characters")]
TooLong,
#[error(
"role description contains invalid characters: only alphanumeric and [{0}] are allowed"
)]
InvalidCharacters(String),
}
fn format_allowed_chars(chars: &[char]) -> String {
chars
.iter()
.map(|c| format!("'{c}'"))
.collect::<Vec<_>>()
.join(", ")
}
View on GitHub (pinned to 06200ef96b)