{"record":{"id":"8bd21702e59efd89","repo":"swc-project/swc","slug":"expected-string-token","errorCode":null,"errorMessage":"Expected string token","messagePattern":"Expected string token","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/swc_css_parser/src/parser/values_and_units/mod.rs","lineNumber":2570,"sourceCode":"\n                Ok(Percentage { span, value })\n            }\n            _ => {\n                unreachable!()\n            }\n        }\n    }\n}\n\nimpl<I> Parse<Str> for Parser<I>\nwhere\n    I: ParserInput,\n{\n    fn parse(&mut self) -> PResult<Str> {\n        let span = self.input.cur_span();\n\n        if !is!(self, \"string\") {\n            return Err(Error::new(span, ErrorKind::Expected(\"string token\")));\n        }\n\n        match bump!(self) {\n            Token::String { value, raw } => Ok(Str {\n                span,\n                value,\n                raw: Some(raw),\n            }),\n            _ => {\n                unreachable!()\n            }\n        }\n    }\n}\n\nimpl<I> Parse<Url> for Parser<I>\nwhere\n    I: ParserInput,","sourceCodeStart":2552,"sourceCodeEnd":2588,"githubUrl":"https://github.com/swc-project/swc/blob/5176682b65416c6b5de6b47379ae1588ea3ecb3f/crates/swc_css_parser/src/parser/values_and_units/mod.rs#L2552-L2588","documentation":"Fired while parsing a Str (CSS string): the current token was not a String token, so no quoted string value could be produced. This `if !is!(self, \"string\")` check is a validation guard; input at fault is a string-required context (e.g. font family, content value, @import href) receiving an unquoted identifier or other token.","triggerScenarios":"Thrown at crates/swc_css_parser/src/parser/values_and_units/mod.rs:2570 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Wrap the value in quotes ('...' or \"...\") to make it a string","Use an Ident parser if an unquoted identifier was intended"],"exampleFix":null,"handlingStrategy":"type-guard","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-14T00:17:10.932Z"}