{"record":{"id":"b503dce33ab9f8ee","repo":"zed-industries/zed","slug":"cannot-be-built-from-json","errorCode":null,"errorMessage":"{} cannot be built from JSON","messagePattern":"(.+?) cannot be built from JSON","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/gpui_macros/src/derive_action.rs","lineNumber":123,"sourceCode":"\n    if name.contains(\"::\") {\n        panic!(\n            \"in #[action] attribute: `name = \\\"{name}\\\"` must not contain `::`, \\\n            also specify `namespace` instead\"\n        );\n    }\n\n    let full_name = if let Some(namespace) = namespace {\n        format!(\"{namespace}::{name}\")\n    } else {\n        name\n    };\n\n    let is_unit_struct = matches!(&input.data, Data::Struct(data) if data.fields.is_empty());\n\n    let build_fn_body = if no_json {\n        let error_msg = format!(\"{} cannot be built from JSON\", full_name);\n        quote! { Err(gpui::private::anyhow::anyhow!(#error_msg)) }\n    } else if is_unit_struct {\n        quote! { Ok(Box::new(Self)) }\n    } else {\n        quote! { Ok(Box::new(gpui::private::serde_json::from_value::<Self>(_value)?)) }\n    };\n\n    let json_schema_fn_body = if no_json || is_unit_struct {\n        quote! { None }\n    } else {\n        quote! { Some(<Self as gpui::private::schemars::JsonSchema>::json_schema(_generator)) }\n    };\n\n    let deprecated_aliases_fn_body = if deprecated_aliases.is_empty() {\n        quote! { &[] }\n    } else {\n        let aliases = deprecated_aliases.iter();\n        quote! { &[#(#aliases),*] }\n    };","sourceCodeStart":105,"sourceCodeEnd":141,"githubUrl":"https://github.com/zed-industries/zed/blob/f4178619acd0d47ea1f76a2025c42962c6d6638c/crates/gpui_macros/src/derive_action.rs#L105-L141","documentation":"Generated by the derive_action macro: the action type was declared with no_json, so its from_json/to_json ActionPayload builders return this error. It fires at runtime when a caller tries to deserialize this action (e.g. replaying serialized keybindings), not at compile time.","triggerScenarios":"Thrown at crates/gpui_macros/src/derive_action.rs:123 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Avoid serializing/deserializing this action type; keep it dispatch-only","If JSON round-tripping is needed, remove no_json and implement proper (de)serialization","Audit generic action-replay paths to skip actions whose type opted out of JSON"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"f4178619acd0d47ea1f76a2025c42962c6d6638c","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}