{"record":{"id":"7ce9268916090dad","repo":"swc-project/swc","slug":"failed-to-parse-as-inputfieldattr","errorCode":null,"errorMessage":"failed to parse as `InputFieldAttr`","messagePattern":"failed to parse as `InputFieldAttr`","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/ast_node/src/spanned.rs","lineNumber":59,"sourceCode":"            is_unknown\n        })\n}\n\nimpl MyField {\n    fn from_field(f: &Field) -> Self {\n        let mut lo = false;\n        let mut hi = false;\n\n        for attr in &f.attrs {\n            if !is_attr_name(attr, \"span\") {\n                continue;\n            }\n\n            match &attr.meta {\n                Meta::Path(..) => {}\n                Meta::List(list) => {\n                    let input = parse2::<InputFieldAttr>(list.tokens.clone())\n                        .expect(\"failed to parse as `InputFieldAttr`\");\n\n                    for kind in input.kinds {\n                        if kind == \"lo\" {\n                            lo = true\n                        } else if kind == \"hi\" {\n                            hi = true\n                        } else {\n                            panic!(\"Unknown span attribute: {kind:?}\")\n                        }\n                    }\n                }\n                _ => panic!(\"Unknown span attribute\"),\n            }\n        }\n\n        Self {\n            ident: f.ident.clone(),\n            ty: f.ty.clone(),","sourceCodeStart":41,"sourceCodeEnd":77,"githubUrl":"https://github.com/swc-project/swc/blob/5176682b65416c6b5de6b47379ae1588ea3ecb3f/crates/ast_node/src/spanned.rs#L41-L77","documentation":"Inside MyField::from_field, a #[span(...)] list attribute on a struct field failed to parse into InputFieldAttr. This fires at macro-expansion time when the span attribute's inner tokens are not the expected list of span kinds — e.g. #[span(foo)] with an unrecognized keyword or a malformed argument — while processing fields for the Spanned derive.","triggerScenarios":"Thrown at crates/ast_node/src/spanned.rs:59 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use only the span kinds supported by the Spanned derive inside #[span(...)]","Remove or fix malformed span attributes on the offending field","Compare with existing fields in swc AST types for correct #[span] usage examples"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"5176682b65416c6b5de6b47379ae1588ea3ecb3f","analyzedAt":"2026-08-17T16:16:52.067Z","contentChangedAt":"2026-08-17T16:16:52.067Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}