{"record":{"id":"320d0955834f1de6","repo":"swc-project/swc","slug":"failed-to-deserialize-swcrc-json-file-msg","errorCode":null,"errorMessage":"failed to deserialize .swcrc (json) file: {msg}: {line}:{column}","messagePattern":"failed to deserialize \\.swcrc \\(json\\) file: (.+?): (.+?):(.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/swc/src/lib.rs","lineNumber":1429,"sourceCode":"#[cfg_attr(debug_assertions, tracing::instrument(skip_all))]\nfn load_swcrc(path: &Path) -> Result<Rc, Error> {\n    let content = read_to_string(path).context(\"failed to read config (.swcrc) file\")?;\n\n    parse_swcrc(&content)\n}\n\nfn parse_swcrc(s: &str) -> Result<Rc, Error> {\n    fn convert_json_err(e: serde_json::Error) -> Error {\n        let line = e.line();\n        let column = e.column();\n\n        let msg = match e.classify() {\n            Category::Io => \"io error\",\n            Category::Syntax => \"syntax error\",\n            Category::Data => \"unmatched data\",\n            Category::Eof => \"unexpected eof\",\n        };\n        Error::new(e).context(format!(\n            \"failed to deserialize .swcrc (json) file: {msg}: {line}:{column}\"\n        ))\n    }\n\n    let v = parse_to_serde_value(\n        s.trim_start_matches('\\u{feff}'),\n        &ParseOptions {\n            allow_comments: true,\n            allow_trailing_commas: true,\n            allow_loose_object_property_names: false,\n        },\n    )?\n    .ok_or_else(|| Error::msg(\"failed to deserialize empty .swcrc (json) file\"))?;\n\n    if let Ok(rc) = serde_json::from_value(v.clone()) {\n        return Ok(rc);\n    }\n","sourceCodeStart":1411,"sourceCodeEnd":1447,"githubUrl":"https://github.com/swc-project/swc/blob/5176682b65416c6b5de6b47379ae1588ea3ecb3f/crates/swc/src/lib.rs#L1411-L1447","documentation":"parse_swcrc could not deserialize the .swcrc file as JSON; convert_json_err classifies the serde_json failure (io, syntax, data, eof) and embeds line:column. Raised while loading configuration, before any file is compiled — the config file itself is broken.","triggerScenarios":"Thrown at crates/swc/src/lib.rs:1429 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix the JSON at the reported line:column in .swcrc","Ensure the file matches the expected Rc config schema","Remove comments/trailing commas or use the JSONC-aware loading path"],"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"}