FyroxEngine/Fyrox · error

Resource error for untyped resource

Error message

Resource error for untyped resource: {err}

What it means

During (de)serialization, UntypedResource::visit delegates to visit_with_type_uuid, which resolves the concrete resource type by UUID. If that fails (unknown type UUID, corrupt data, wrong type), the error is logged, the visitor region is dumped for debugging, and the error is recorded on the resource state.

Solutions

  1. Ensure the concrete resource type is registered with the resource system before loading
  2. Re-save or fix the resource file so its type UUID matches a known type
  3. Check engine version compatibility of the data file
  4. Use the region debug dump to locate the malformed field

Example fix

null
Defensive patterns

Strategy: try-catch

Try / catch

match untyped_resource.visit(name, visitor) {
    Err(e) => {
        // e carries the underlying VisitError; inspect type UUID registration
    }
    Ok(_) => {}
}

Prevention

When it happens

Trigger: Loading a scene/resource file containing an UntypedResource whose saved type UUID has no registered visitor, or whose embedded payload fails to deserialize.

Common situations: Renamed or removed resource types between engine versions loading old files; missing resource plugin/registration; hand-edited or corrupted .rgs files.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


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

Appendix: source

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

impl Serialize for UntypedResource {
    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        let header = self.lock();
        if header.kind == ResourceKind::Embedded {
            panic!("Embedded resources cannot be serialized.");
        }
        header.uuid.serialize(serializer)
    }
}

impl Visit for UntypedResource {
    fn visit(&mut self, name: &str, visitor: &mut Visitor) -> VisitResult {
        let result = self.visit_with_type_uuid(name, None, visitor);
        if let Err(err) = &result {
            Log::err(format!("Resource error for untyped resource: {err}"));
            if let Ok(region) = visitor.enter_region(name) {
                region.debug();
            }
            self.commit_error(PathBuf::default(), err.to_string());
        }
        result
    }
}

impl Display for UntypedResource {
    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
        if let Some(header) = self.0.try_lock() {
            Display::fmt(&header, f)
        } else {
            f.write_str("locked")
        }
    }
}

View on GitHub (pinned to 76c91aad8e)