{"record":{"id":"c734183cc83f0c12","repo":"DioxusLabs/dioxus","slug":"attempted-to-exclude-a-layout-that-does-not-exist","errorCode":null,"errorMessage":"Attempted to exclude a layout that does not exist","messagePattern":"Attempted to exclude a layout that does not exist","errorType":"validation","errorClass":"syn::Error","httpStatus":null,"severity":"error","filePath":"packages/router-macro/src/lib.rs","lineNumber":386,"sourceCode":"                        for mut segment in iter {\n                            segment.children.push(current);\n                            current = segment;\n                        }\n\n                        children.push(current);\n                    }\n                } else if attr.path().is_ident(\"layout\") {\n                    let parser = |input: ParseStream| {\n                        let bang: Option<Token![!]> = input.parse().ok();\n                        let exclude = bang.is_some();\n                        Ok((exclude, Layout::parse(input, nest_stack.clone())?))\n                    };\n                    let (exclude, layout): (bool, Layout) = attr.parse_args_with(parser)?;\n\n                    if exclude {\n                        let Some(layout_index) = layouts.iter().position(|l| l.comp == layout.comp)\n                        else {\n                            return Err(syn::Error::new(\n                                Span::call_site(),\n                                \"Attempted to exclude a layout that does not exist\",\n                            ));\n                        };\n                        excluded.push(LayoutId(layout_index));\n                    } else {\n                        let layout_index = layouts.len();\n                        layouts.push(layout);\n                        layout_stack.push(LayoutId(layout_index));\n                    }\n                } else if attr.path().is_ident(\"end_layout\") {\n                    layout_stack.pop();\n                } else if attr.path().is_ident(\"redirect\") {\n                    let parser = |input: ParseStream| {\n                        Redirect::parse(input, nest_stack.clone(), endpoints.len())\n                    };\n                    let redirect = attr.parse_args_with(parser)?;\n                    endpoints.push(RouteEndpoint::Redirect(redirect));","sourceCodeStart":368,"sourceCodeEnd":404,"githubUrl":"https://github.com/DioxusLabs/dioxus/blob/393d190a801ccb441d41923e232289b4f8a5c669/packages/router-macro/src/lib.rs#L368-L404","documentation":"Error \"Attempted to exclude a layout that does not exist\" thrown in DioxusLabs/dioxus.","triggerScenarios":"Thrown at packages/router-macro/src/lib.rs:386 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"393d190a801ccb441d41923e232289b4f8a5c669","analyzedAt":"2026-08-16T11:27:45.815Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}