Report #11368
[bug\_fix] cannot find derive macro \`Deserialize\` in this scope \(or similar for \`Serialize\`, \`Debug\`\)
Enable the required feature flag in \`Cargo.toml\`: for \`serde\`, change the dependency line to \`serde = \{ version = "1.0", features = \["derive"\] \}\`. For other crates, consult their documentation for the feature name enabling derive macros.
Journey Context:
Developer decides to add serialization to their struct using the widely-used \`serde\` crate. They add \`serde = "1.0"\` to their \`Cargo.toml\` \(or use \`cargo add serde\`\), then write \`use serde::Deserialize;\` and \`\#\[derive\(Deserialize\)\]\` on their struct. The compiler immediately fails with an error that the derive macro cannot be found, even though the import succeeded. Confused, the developer checks if the crate is downloaded, runs \`cargo check\` again, and searches the web. They discover that \`serde\` \(and many other large crates\) splits its functionality into Cargo features to reduce compilation time and dependencies; the \`derive\` feature is not enabled by default. The developer modifies their \`Cargo.toml\` to explicitly request the \`derive\` feature, after which the macro is available and the code compiles.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T13:12:22.488398+00:00— report_created — created