influxdata/influxdb · error · ResourceMappingError

missing resource id

Error message

missing resource id {0}

What it means

ResourceMappingError::MissingResourceId is thrown when a resource entry that must be identified by ID has no ID — the id string is empty or absent during resource mapping. It is the ID-based counterpart of MissingResourceName.

Solutions

  1. Ensure every resource entry carries a non-empty resource id before mapping.
  2. Fail fast on earlier lookups: if resource_name_to_id fails, do not continue with an empty id.
  3. Repair or regenerate the permission records that are missing ids.

Example fix

// before
let id = ""; // missing
// after
let id = "0x1234abcd"; // valid resource id
Defensive patterns

Strategy: validation

Validate before calling

fn require_id(entry: &PermissionEntry) -> Result<&str, String> {
    entry.id.as_deref().filter(|i| !i.is_empty()).ok_or_else(|| "missing resource id".to_string())
}

Try / catch

let id = require_id(&entry).map_err(ResourceMappingError::MissingResourceId)?;

Prevention

When it happens

Trigger: Passing a resource record with an empty/absent id field into mapping functions that resolve resources by id when constructing token permissions.

Common situations: Deserialized permission data lacking the resource id; a lookup that failed earlier and silently produced an empty id; partial migration of permission records.

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


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

Appendix: source

Thrown at influxdb3_authz/src/permissions.rs:42

pub const AUTHZ_READ_CRUD_ACTION: &str = "read";
pub const AUTHZ_UPDATE_CRUD_ACTION: &str = "update";
pub const AUTHZ_DELETE_CRUD_ACTION: &str = "delete";

pub const AUTHZ_WILDCARD: &str = "*";

#[derive(Debug, Error)]
pub enum ResourceMappingError {
    #[error("resource type not supported {0}")]
    ResourceTypeNotSupported(String),
    #[error("invalid resource name {0}")]
    InvalidResourceName(String),
    #[error("mixed wildcard (*) and resource name")]
    MixedWildcardAndRegularResourceName,
    #[error("missing resource name {0}")]
    MissingResourceName(String),
    #[error("action not supported, {0}")]
    ActionNotSupported(String),
    #[error("missing resource id {0}")]
    MissingResourceId(String),
}

pub trait ResourceNameToIdProvider {
    fn resource_name_to_id(
        &self,
        resource_type: ResourceType,
        names: &[String],
    ) -> Result<ResourceIdentifier, ResourceMappingError>;
}

pub trait ResourceIdToNameProvider {
    fn resource_id_to_name(
        &self,
        identifier: &ResourceIdentifier,
    ) -> Vec<Result<String, ResourceMappingError>>;
}

View on GitHub (pinned to 06200ef96b)