influxdata/influxdb · error · NewRoleDescriptionError

role description exceeds maximum length of

Error message

role description exceeds maximum length of {ROLE_DESCRIPTION_MAX_LENGTH} characters

What it means

NewRoleDescriptionError::TooLong, a validation guard in role.rs enforcing NewRoleDescription's ROLE_DESCRIPTION_MAX_LENGTH; it fires when constructing a role description from user-supplied input that exceeds the allowed character cap.

Solutions

  1. Shorten the description to at most ROLE_DESCRIPTION_MAX_LENGTH characters
  2. Move long documentation to external docs and keep a brief summary in the description
  3. Truncate programmatically with the constant ROLE_DESCRIPTION_MAX_LENGTH before submitting

Example fix

// before
let desc = very_long_runbook_text; // > ROLE_DESCRIPTION_MAX_LENGTH
// after
let desc: String = very_long_runbook_text.chars().take(ROLE_DESCRIPTION_MAX_LENGTH).collect();
Defensive patterns

Strategy: validation

Validate before calling

const ROLE_DESCRIPTION_MAX_LENGTH: usize = 255; // confirm exact constant in influxdb3_authz/src/role/role.rs
fn valid_role_description(desc: &str) -> bool {
    desc.chars().count() <= ROLE_DESCRIPTION_MAX_LENGTH
}

Prevention

When it happens

Trigger: Submitting a role description longer than ROLE_DESCRIPTION_MAX_LENGTH characters through role creation or update endpoints.

Common situations: Pasting long policy documents or runbooks into the description field; programmatic generation of verbose descriptions.

Understand the failure class

Background: "value must be between 0 and 1" / "out of range" / "must not be negative" errors: fixing range-validation failures across open-source libraries — this error's family across 42 libraries.

Related errors


AI-assisted analysis of influxdata/influxdb@06200ef96b (2026-09-19). Data as JSON: /api/errors/789bfcf1eabd04c1. Report an issue: GitHub.

Appendix: source

Thrown at influxdb3_authz/src/role/role.rs:138

        }

        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)