quickwit-oss/quickwit · error · proc-macro compile error

structure doesn't implement deserialize but a deserializer…

Error message

structure doesn't implement deserialize but a deserializer is defined

What it means

The inverse of error 327: a field declares a `try_from` (deserializer) conversion but the struct does not implement Deserialize, so the conversion would be unused. The macro rejects this inconsistency at compile time.

Solutions

  1. Add Deserialize to the struct's derives if deserialization is intended.
  2. Or remove the unused `try_from` conversion from the field config.

Example fix

// before
#[derive(Serialize)]
#[serde_multikey(fields(v(try_from = from_str)))]
struct Foo { v: u64 }
// after
#[derive(Serialize, Deserialize)]
#[serde_multikey(fields(v(try_from = from_str)))]
struct Foo { v: u64 }
Defensive patterns

Strategy: validation

Validate before calling

// Only define `try_from` conversions on structs that derive Deserialize:
// #[derive(Deserialize)] or #[derive(Serialize, Deserialize)] + try_from = ...

Prevention

When it happens

Trigger: Struct has only #[derive(Serialize)] (no Deserialize) yet a field config in #[serde_multikey(...)] defines a `try_from`/deserializer conversion.

Common situations: Copy-pasting a fully-specified field config from a Serialize+Deserialize struct into a serialize-only struct.

Understand the failure class

Background: Conflicting config options: "cannot be used together" — configuration validation errors across open-source libraries — this error's family across 162 libraries.

Related errors


AI-assisted analysis of quickwit-oss/quickwit@a39730c5cd (2026-09-08). Data as JSON: /api/errors/54394e3b7b37b5c7. Report an issue: GitHub.

Appendix: source

Thrown at quickwit/quickwit-macros/src/lib.rs:206

                    return Err(Error::new(
                        field_name.span(),
                        "structure doesn't implement serialize but a serializer is defined",
                    ));
                }
            }
            match (de, field_config.get_try_from(&value)) {
                (true, Some(conv)) => {
                    try_from_conv.push(conv);
                }
                (false, None) => (),
                (true, None) => {
                    return Err(Error::new(
                        field_name.span(),
                        "structure implement deserialize but no deserializer defined",
                    ));
                }
                (false, Some(_)) => {
                    return Err(Error::new(
                        field_name.span(),
                        "structure doesn't implement deserialize but a deserializer is defined",
                    ));
                }
            }
        } else {
            pass_through.push(field_name);
            final_fields.push(field);
            if let Some(ponct) = ponct {
                final_fields.push_punct(ponct);
            }
        }
    }
    input.fields = Fields::Named(FieldsNamed {
        brace_token,
        named: final_fields,
    });

View on GitHub (pinned to a39730c5cd)