{"record":{"id":"2836480292c5c3e9","repo":"DioxusLabs/dioxus","slug":"props-is-not-supported-for-unions","errorCode":null,"errorMessage":"Props is not supported for unions","messagePattern":"Props is not supported for unions","errorType":"validation","errorClass":"syn::Error","httpStatus":null,"severity":"error","filePath":"packages/core-macro/src/props/mod.rs","lineNumber":69,"sourceCode":"            }\n            syn::Fields::Unnamed(_) => {\n                return Err(Error::new(\n                    ast.span(),\n                    \"Props is not supported for tuple structs\",\n                ));\n            }\n            syn::Fields::Unit => {\n                return Err(Error::new(\n                    ast.span(),\n                    \"Props is not supported for unit structs\",\n                ));\n            }\n        },\n        syn::Data::Enum(_) => {\n            return Err(Error::new(ast.span(), \"Props is not supported for enums\"));\n        }\n        syn::Data::Union(_) => {\n            return Err(Error::new(ast.span(), \"Props is not supported for unions\"));\n        }\n    };\n    Ok(data)\n}\n\nmod util {\n    use quote::ToTokens;\n\n    pub fn path_to_single_string(path: &syn::Path) -> Option<String> {\n        if path.leading_colon.is_some() {\n            return None;\n        }\n        let mut it = path.segments.iter();\n        let segment = it.next()?;\n        if it.next().is_some() {\n            // Multipart path\n            return None;\n        }","sourceCodeStart":51,"sourceCodeEnd":87,"githubUrl":"https://github.com/DioxusLabs/dioxus/blob/24f6a829df0dfa203961a98ea4cae21c2ff27e28/packages/core-macro/src/props/mod.rs#L51-L87","documentation":"The `#[derive(Props)]` macro rejects unions at derive expansion time, emitting this compile error at the struct/union span. Component props must be structs with named fields; unions cannot represent a set of prop fields, so deriving Props on a union is unsupported.","triggerScenarios":"Thrown at packages/core-macro/src/props/mod.rs:69 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Define props as a struct with named fields instead of a union; the Props derive only supports structs."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"24f6a829df0dfa203961a98ea4cae21c2ff27e28","analyzedAt":"2026-08-23T07:10:14.078Z","contentChangedAt":"2026-08-23T07:10:14.078Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}