{"record":{"id":"7d2fcd3ea127a65b","repo":"leptos-rs/leptos","slug":"list-of-slots-must-not-be-empty-7d2fcd","errorCode":null,"errorMessage":"List of slots must not be empty","messagePattern":"List of slots must not be empty","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"leptos_macro/src/view/slot_helper.rs","lineNumber":171,"sourceCode":"                }\n            } else {\n                quote_spanned! {children.span()=>\n                    .children({\n                        #(#clonables)*\n\n                        ::leptos::children::ToChildren::to_children(move || #children #view_marker)\n                    })\n                }\n            }\n        } else {\n            quote! {}\n        }\n    };\n\n    let slots = slots.drain().map(|(slot, mut values)| {\n        let span = values\n            .last()\n            .expect(\"List of slots must not be empty\")\n            .span();\n        let slot = Ident::new(&slot, span);\n        let value = if values.len() > 1 {\n            quote! {\n                ::std::vec![\n                    #(#values)*\n                ]\n            }\n        } else {\n            values.remove(0)\n        };\n\n        quote! { .#slot(#value) }\n    });\n\n    let build = quote_spanned! {node.name().span()=>\n        .build()\n    };","sourceCodeStart":153,"sourceCodeEnd":189,"githubUrl":"https://github.com/leptos-rs/leptos/blob/32d20f6c9d517451d77beb68d88c7716823dac41/leptos_macro/src/view/slot_helper.rs#L153-L189","documentation":"slot_to_tokens in leptos_macro collects component slot properties into a map and then drains it, taking .last() of each slot's values to get a span. If a slot key exists in the map with an empty values vec, the expect panics with 'List of slots must not be empty'. This is a compile-time panic inside the view! macro expansion.","triggerScenarios":"A slot entry is inserted into the slots map with no accumulated values — an internal invariant violation when processing component children with #[slot] attributes; typically triggered by malformed or duplicated slot handling in the view! macro (e.g. a slot property with zero children tokens).","commonSituations":"Using view! with a custom component taking #[slot] parameters where slot markup is empty or the macro version has a bug collecting slot values; mixing macro versions between leptos and leptos_macro.","solutions":["Ensure each slot passed to the component actually contains content, e.g. <SlotName slot:A>{...}</SlotName> with children or attributes.","Update leptos_macro/leptos to matching versions (cargo update) — empty slot values may be a fixed macro bug.","Reduce the view! usage to a minimal repro and report it upstream if the slot is non-empty but still triggers the panic."],"exampleFix":"// before\n<Parent slot:header /> // empty slot\n// after\n<Parent slot:header><h1>\"Title\"</h1></Parent>","handlingStrategy":"validation","validationCode":"// check all slot properties have content before macro expansion\nfn slot_has_content(inner: &str) -> bool { !inner.trim().is_empty() }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Give every slot: property children/attributes; keep leptos_macro versions aligned"],"tags":["leptos","proc-macro","slots","compile-time"],"backgroundTag":"empty-slot-values-macro-panic","analyzedSha":"32d20f6c9d517451d77beb68d88c7716823dac41","analyzedAt":"2026-09-01T18:55:42.580Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T01:17:15.007Z"}