{"record":{"id":"27cf73372abde310","repo":"influxdata/influxdb","slug":"role-name-exceeds-maximum-length-of-role-name-max-length","errorCode":null,"errorMessage":"role name exceeds maximum length of {ROLE_NAME_MAX_LENGTH} characters","messagePattern":"role name exceeds maximum length of (.+?) characters","errorType":"validation","errorClass":"NewRoleNameError","httpStatus":null,"severity":"error","filePath":"influxdb3_authz/src/role/role.rs","lineNumber":90,"sourceCode":"        &self.0\n    }\n\n    pub fn into_inner(self) -> String {\n        self.0\n    }\n}\n\nimpl std::fmt::Display for RoleName {\n    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {\n        write!(f, \"{}\", self.0)\n    }\n}\n\n#[derive(Debug, Clone, Error)]\npub enum NewRoleNameError {\n    #[error(\"role name cannot be empty\")]\n    Empty,\n    #[error(\"role name exceeds maximum length of {ROLE_NAME_MAX_LENGTH} characters\")]\n    TooLong,\n    #[error(\"role name contains invalid characters: only alphanumeric and [{0}] are allowed\")]\n    InvalidCharacters(String),\n}\n\n#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]\npub struct RoleDescription(String);\n\nimpl RoleDescription {\n    pub fn as_str(&self) -> &str {\n        &self.0\n    }\n\n    pub fn new(description: &str) -> Result<Self, NewRoleDescriptionError> {\n        if description.is_empty() {\n            return Err(NewRoleDescriptionError::Empty);\n        }\n","sourceCodeStart":72,"sourceCodeEnd":108,"githubUrl":"https://github.com/influxdata/influxdb/blob/06200ef96ba82c5f6727e5038a83af8e722c6875/influxdb3_authz/src/role/role.rs#L72-L108","documentation":"NewRoleNameError::TooLong is returned when validating a role name that is longer than ROLE_NAME_MAX_LENGTH characters. The role system enforces a name length cap so role identifiers stay usable in HTTP APIs, catalogs, and logs. Validation happens when constructing a new RoleName via its TryFrom/constructor path.","triggerScenarios":"Calling the role-creation API (e.g. POST /api/v0/configure/... role endpoints or NewRoleName::new) with a name string whose character count exceeds ROLE_NAME_MAX_LENGTH.","commonSituations":"Auto-generated role names embedding long team/project names, concatenating prefixes like 'team-' plus an email or UUID, or names built from long org identifiers.","solutions":["Shorten the role name to at most ROLE_NAME_MAX_LENGTH characters and retry","Check the limit at compile/source time (constant ROLE_NAME_MAX_LENGTH in influxdb3_authz/src/role/role.rs) and validate input length before calling the API","If generating names programmatically, truncate or hash long components while keeping them unique"],"exampleFix":"// before\nlet name = format!(\"role-for-{}-{}\", long_team_name, environment); // may exceed limit\n// after\nlet name: String = format!(\"role-{}-{}\", truncate(&long_team_name, 32), environment)\n    .chars().take(ROLE_NAME_MAX_LENGTH).collect();","handlingStrategy":"validation","validationCode":"const ROLE_NAME_MAX_LENGTH: usize = 80; // confirm exact constant in influxdb3_authz/src/role/role.rs\nfn valid_role_name(name: &str) -> bool {\n    !name.is_empty() && name.chars().count() <= ROLE_NAME_MAX_LENGTH\n}","typeGuard":"fn check_role_name(name: &str) -> Result<&str, String> {\n    if name.chars().count() <= ROLE_NAME_MAX_LENGTH { Ok(name) } else { Err(format!(\"role name exceeds {ROLE_NAME_MAX_LENGTH} chars\")) }\n}","tryCatchPattern":null,"preventionTips":["Check ROLE_NAME_MAX_LENGTH in the library source before generating role names","Keep auto-generated role names short by truncating or hashing long components","Validate name length in the UI/API client before submission"],"tags":["validation","role-management","rust"],"backgroundTag":"value-out-of-range","analyzedSha":"06200ef96ba82c5f6727e5038a83af8e722c6875","analyzedAt":"2026-09-19T12:55:30.003Z","contentChangedAt":"2026-09-19T12:55:30.003Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}