bevyengine/bevy · error · BrpError

-32603

-32603

Error message

Unexpected format of serialized resource value

What it means

BrpError (RESOURCE_ERROR) raised in the BRP get-resources handler: the serialized resource value did not have the expected object/map shape after ReflectSerializer, so it cannot be returned as a resource value.

Solutions

  1. Check the resource's reflect serialization implementation produces a map
  2. Verify the resource type is properly reflected and registered
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at crates/bevy_remote/src/builtin_methods.rs:655 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of bevyengine/bevy@a62cce8c05 (2026-08-20). Data as JSON: /api/errors/887dc8842a77f6e6. Report an issue: GitHub.

Appendix: source

Thrown at crates/bevy_remote/src/builtin_methods.rs:718

        return Err(BrpError::resource_not_present(&resource_path));
    };

    // Use the `ReflectSerializer` to serialize the value of the resource;
    // this produces a map with a single item.
    let reflect_serializer = ReflectSerializer::new(reflected.as_partial_reflect(), &type_registry);
    let Value::Object(serialized_object) =
        serde_json::to_value(&reflect_serializer).map_err(BrpError::resource_error)?
    else {
        return Err(BrpError {
            code: error_codes::RESOURCE_ERROR,
            message: format!("Resource `{resource_path}` could not be serialized"),
            data: None,
        });
    };

    // Get the single value out of the map.
    let value = serialized_object.into_values().next().ok_or_else(|| {
        BrpError::internal(anyhow!("Unexpected format of serialized resource value"))
    })?;
    let response = BrpGetResourcesResponse { value };
    serde_json::to_value(response).map_err(BrpError::internal)
}

/// Handles a `world.get_components+watch` request coming from a client.
pub fn process_remote_get_components_watching_request(
    In(params): In<Option<Value>>,
    world: &World,
    mut removal_cursors: Local<HashMap<ComponentId, MessageCursor<RemovedComponentEntity>>>,
) -> BrpResult<Option<Value>> {
    let BrpGetComponentsParams {
        entity,
        components,
        strict,
    } = parse_some(params)?;

    let app_type_registry = world.resource::<AppTypeRegistry>();

View on GitHub (pinned to a62cce8c05)