influxdata/influxdb · error · NewRoleDescriptionError
role description cannot be empty
Error message
role description cannot be empty
What it means
NewRoleDescriptionError::Empty is returned when a role description is supplied as an empty string. The library requires a non-empty description when constructing RoleDescription so every role carries meaningful human-readable context.
Solutions
- Provide a non-empty description string when creating/updating the role
- If the description is truly optional, supply a placeholder such as "(no description)" if the schema mandates a value
- Validate with !description.trim().is_empty() before calling the API
Example fix
// before let desc = ""; // rejected // after let desc = "Grants read access to telemetry buckets";
Defensive patterns
Strategy: validation
Validate before calling
fn valid_role_description(desc: &str) -> bool {
!desc.trim().is_empty()
} Prevention
- Make description a required, non-blank field in forms and API clients
- Reject whitespace-only descriptions before submission
- Provide sensible default descriptions for automated role creation
When it happens
Trigger: Creating or updating a role with description = "" via the role management API or RoleDescription::try_from/new.
Common situations: UI forms that allow submitting a blank description field, or API clients that default description to an empty string instead of omitting or providing real text.
Understand the failure class
Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.
Related errors
- role description contains invalid characters: only…
- 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/906d0733d8021888.
Report an issue: GitHub.
Appendix: source
Thrown at influxdb3_authz/src/role/role.rs:136
format_allowed_chars(ROLE_DESCRIPTION_ALLOWED_SPECIAL_CHARS),
));
}
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)