{"record":{"id":"a1332c2b67dbcbd0","repo":"tracel-ai/burn","slug":"path-segment-has-no-generic","errorCode":null,"errorMessage":"Path segment {} has no generic","messagePattern":"Path segment (.+?) has no generic","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/burn-derive/src/shared/field.rs","lineNumber":39,"sourceCode":"            syn::Type::Path(path) => {\n                let name = Self::path_name(path);\n                paths.contains(&name.as_str())\n            }\n            _ => false,\n        }\n    }\n\n    #[allow(dead_code)]\n    pub fn first_generic_field(&self) -> TypePath {\n        let err = || panic!(\"Field {} as no generic\", self.field.ident.clone().unwrap());\n        match &self.field.ty {\n            syn::Type::Path(path) => Self::path_generic_argument(path),\n            _ => err(),\n        }\n    }\n    pub fn path_generic_argument(path: &TypePath) -> TypePath {\n        let segment = path.path.segments.last().unwrap();\n        let err = || panic!(\"Path segment {} has no generic\", segment.ident.clone(),);\n        match &segment.arguments {\n            syn::PathArguments::None => err(),\n            syn::PathArguments::AngleBracketed(param) => {\n                let first_param = param.args.first().unwrap();\n\n                if let syn::GenericArgument::Type(Type::Path(path)) = first_param {\n                    path.clone()\n                } else {\n                    err()\n                }\n            }\n            syn::PathArguments::Parenthesized(_) => err(),\n        }\n    }\n\n    fn path_name(path: &TypePath) -> String {\n        let length = path.path.segments.len();\n        let mut name = String::new();","sourceCodeStart":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/tracel-ai/burn/blob/d16f7ba2ed0d41408189384044cc886fb4c8f957/crates/burn-derive/src/shared/field.rs#L21-L57","documentation":"Segment-level guard in the same helper: `path_generic_argument` takes the last path segment and panics with the segment name when that segment has no generic arguments (e.g. field type `Tensor` without `<B, D>`, or a segment like `Vec` accessed mid-path). It reports derive-codegen expectations versus the actual written type; the input at fault is the generic-less path segment.","triggerScenarios":"Thrown at crates/burn-derive/src/shared/field.rs:39 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Add the expected generic parameters to the field type (e.g. `MyType<B>` rather than `MyType`).","Verify the codegen path targets the correct segment — fully qualify the type so the generic segment is analyzed.","Use the appropriate module attribute to skip fields that legitimately have no generics."],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"d16f7ba2ed0d41408189384044cc886fb4c8f957","analyzedAt":"2026-09-05T13:19:14.260Z","contentChangedAt":"2026-09-05T13:19:14.260Z","schemaVersion":2},"datasetVersion":"2026-09-12T17:17:11.597Z"}