#7482·surrealdb

`derive(SurrealValue)` + `crate = "..."` + `tag = "..."` = don't compile

Author: tguichaouaCreated Aug 20, 2026Updated Sep 28, 2026
Labelstriagetopic:rustsdk-issue

What component does this affect?

SurrealDB Rust SDK

Describe the bug

When deriveing the SurrealValue trait on an enum with both #[surreal(crate = "surrealdb_custom_path::types")] and #[tag = "kind"], it fails to compile because it cannot find Value.

Using cargo expand, it seems there is some places where the macro hyegiene is not respected, for example:

rust
    fn from_value(
        value: surrealdb_custom_path::types::Value,
    ) -> std::result::Result<Self, surrealdb_custom_path::types::Error> {
        match value {
            surrealdb_custom_path::types::Value::Object(mut map) => {
                {
                    if map
                        .get("kind")
                        .is_some_and(|v| v == Value::String("Goo".to_string())) // <- HERE
                    {

Steps to reproduce

Cargo.toml

toml
[package]
name = "compile"
version = "0.1.0"
edition = "2024"

[dependencies]
surrealdb_custom_path = { package = "surrealdb", version = "3.2.4" }

lib.rs

rust
use surrealdb_custom_path::types::SurrealValue;

#[derive(SurrealValue)]
#[surreal(crate = "surrealdb_custom_path::types")]
#[surreal(tag = "kind")]
pub enum Foo {
    Goo { x: u64 },
    Hoo { x: u64 },
}

Expected behaviour

It should compiles without error.

SurrealDB version

3.2.4

Contact Details

No response

Could this be a bug with your application?

  • I confirm this is a bug with SurrealDB, not with my own application

Is there an existing issue for this?

  • I confirm that I have searched the existing issues

Code of Conduct

  • I agree to follow this project's Code of Conduct