FyroxEngine/Fyrox · error

Resource manager must be available when deserializing…

Error message

Resource manager must be available when deserializing resources!

What it means

When deserializing a Resource in 'by handle/uuid' mode, visit_with_type_uuid fetches the ResourceManager from the visitor blackboard to re-request the resource. If no ResourceManager was registered on the visitor, it panics. Deserializing resources therefore requires the resource manager to be part of the visitor environment.

Solutions

  1. Register the ResourceManager in the visitor blackboard before visiting: visitor.blackboard.register(resource_manager.clone()).
  2. Use the engine/scene standard save/load paths (SceneLoader, ResourceManager) which set up the environment automatically.
  3. If only serializing values (not resource references), ensure the resource is embedded rather than referenced, avoiding the manager lookup branch.

Example fix

// before
let mut visitor = Visitor::new();
resource.visit("MyResource", &mut visitor)?; // panics
// after
let mut visitor = Visitor::new();
visitor.blackboard.register(resource_manager.clone());
resource.visit("MyResource", &mut visitor)?;
Defensive patterns

Strategy: validation

Validate before calling

assert!(visitor.blackboard.get_opt::<ResourceManager>().is_some());

Prevention

When it happens

Trigger: Calling UntypedResource::visit (deserializing a resource reference) with a Visitor that lacks a registered ResourceManager in its blackboard — common when saving/loading resources manually instead of through the standard loaders.

Common situations: Hand-rolling serialization of assets outside the engine's loaders; test harnesses that build Visitors without the resource manager; editor tooling that serializes resource references with a bare Visitor.

Understand the failure class

Background: "not installed", "pip install", "required for": how missing-dependency errors surface across open-source libraries — this error's family across 34 libraries.

Related errors


AI-assisted analysis of FyroxEngine/Fyrox@76c91aad8e (2026-09-10). Data as JSON: /api/errors/eeafc02b3dc057d1. Report an issue: GitHub.

Appendix: source

Thrown at fyrox-resource/src/untyped.rs:347

impl UntypedResource {
    /// Visit this resource handle with the given UUID for the type of the resource data.
    pub fn visit_with_type_uuid(
        &mut self,
        name: &str,
        type_uuid: Option<Uuid>,
        visitor: &mut Visitor,
    ) -> VisitResult {
        let mut region = visitor.enter_region(name)?;
        if region.is_reading() {
            let mut uuid = Uuid::default();
            uuid.visit("Uuid", &mut region)?;
            self.read_visit(uuid, type_uuid, &mut region)?;
            drop(region);
            let resource_manager = visitor
                .blackboard
                .get::<ResourceManager>()
                .expect("Resource manager must be available when deserializing resources!")
                .clone();
            resource_manager.state().request_resource(self);
            Ok(())
        } else {
            self.resource_uuid().visit("Uuid", &mut region)?;
            let header_guard = self.lock();
            let is_embedded = header_guard.kind.is_embedded();
            let is_ok = header_guard.state.is_ok();
            drop(header_guard);
            if is_embedded && is_ok {
                self.0.visit("Embedded", &mut region)
            } else if is_embedded {
                true.visit("Default", &mut region)
            } else {
                Ok(())
            }
        }
    }

View on GitHub (pinned to 76c91aad8e)