{"record":{"id":"c8162676d9fb245b","repo":"vercel/next.js","slug":"serialization-hash-only-makes-sense-with-cell","errorCode":null,"errorMessage":"serialization = \"hash\" only makes sense with cell = \"compare\" (or default)","messagePattern":"serialization = \"hash\" only makes sense with cell = \"compare\" \\(or default\\)","errorType":"validation","errorClass":"syn::Error","httpStatus":null,"severity":"critical","filePath":"turbopack/crates/turbo-tasks-macros/src/value_macro.rs","lineNumber":282,"sourceCode":"pub fn value(args: TokenStream, input: TokenStream) -> TokenStream {\n    let item = parse_macro_input!(input as Item);\n    let ValueArguments {\n        serialization_mode,\n        evict_mode,\n        shared,\n        cell_mode,\n        manual_eq,\n        manual_hash,\n        transparent,\n        operation,\n        task_input,\n    } = parse_macro_input!(args as ValueArguments);\n\n    // `serialization = \"hash\"` only makes sense with `cell = \"compare\"` (the default).\n    if matches!(serialization_mode, SerializationMode::Hash)\n        && !matches!(cell_mode, CellMode::Compare)\n    {\n        return syn::Error::new(\n            proc_macro2::Span::call_site(),\n            \"serialization = \\\"hash\\\" only makes sense with cell = \\\"compare\\\" (or default)\",\n        )\n        .to_compile_error()\n        .into();\n    }\n\n    // `hash = \"manual\"` only makes sense with `serialization = \"hash\"`.\n    if manual_hash && !matches!(serialization_mode, SerializationMode::Hash) {\n        return syn::Error::new(\n            proc_macro2::Span::call_site(),\n            \"hash = \\\"manual\\\" only makes sense with serialization = \\\"hash\\\"\",\n        )\n        .to_compile_error()\n        .into();\n    }\n\n    // `evict = \"last\"` only makes sense for `serialization = \"skip\"`: it","sourceCodeStart":264,"sourceCodeEnd":300,"githubUrl":"https://github.com/vercel/next.js/blob/0ae8c72462952df163f1b1e0726641bc5b40dc93/turbopack/crates/turbo-tasks-macros/src/value_macro.rs#L264-L300","documentation":"This is a compile-time error emitted by the #[turbo_tasks::value] proc-macro. serialization = \"hash\" persists only a hash of the value so post-eviction reads can skip re-derivation by comparing hashes — which only works when cells are deduplicated by value comparison (cell = \"compare\", the default). Combining serialization = \"hash\" with cell = \"keyed\" or cell = \"new\" is contradictory, so the macro refuses to compile.","triggerScenarios":"Annotating a value type with both serialization = \"hash\" and a non-compare cell mode, e.g. #[turbo_tasks::value(serialization = \"hash\", cell = \"new\")] or cell = \"keyed\".","commonSituations":"A Turbopack contributor adding a new value type and copying attributes from another type without understanding the serialization/cell interaction; refactoring a type's cell mode while leaving serialization = \"hash\".","solutions":["Remove the cell override so it defaults to \"compare\": #[turbo_tasks::value(serialization = \"hash\")].","Or explicitly set cell = \"compare\" if you want it documented.","If you genuinely need cell = \"new\" or \"keyed\", change serialization to \"auto\", \"custom\", or \"skip\" instead of \"hash\"."],"exampleFix":"// before\n#[turbo_tasks::value(serialization = \"hash\", cell = \"new\")]\nstruct Foo { ... }\n\n// after\n#[turbo_tasks::value(serialization = \"hash\")] // cell defaults to \"compare\"\nstruct Foo { ... }","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["When using serialization = \"hash\", omit the cell attribute (defaults to compare) or set cell = \"compare\" explicitly.","Use cell = \"new\"/\"keyed\" only with serialization modes auto, custom, or skip.","Cross-check attribute combinations against the macro validation rules in value_macro.rs:278-317."],"tags":["proc-macro","turbo-tasks","value-attributes","compile-error"],"analyzedSha":"0ae8c72462952df163f1b1e0726641bc5b40dc93","analyzedAt":"2026-08-06T19:44:29.143Z","schemaVersion":2},"datasetVersion":"2026-08-07T02:17:10.218Z"}