{"record":{"id":"38a870e88f0b087f","repo":"swc-project/swc","slug":"failed-to-parse-inline-source-map-not-base64-ur","errorCode":null,"errorMessage":"failed to parse inline source map: not base64: {url:?}","messagePattern":"failed to parse inline source map: not base64: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/swc/src/lib.rs","lineNumber":452,"sourceCode":"        &self,\n        fm: &SourceFile,\n        input_src_map: &InputSourceMap,\n        comments: &[Comment],\n        is_default: bool,\n    ) -> Result<Option<sourcemap::SourceMap>, Error> {\n        self.run(|| -> Result<_, Error> {\n            let name = &fm.name;\n\n            let read_inline_sourcemap =\n                |data_url: &str| -> Result<Option<sourcemap::SourceMap>, Error> {\n                    let url = Url::parse(data_url).with_context(|| {\n                        format!(\"failed to parse inline source map url\\n{data_url}\")\n                    })?;\n\n                    let idx = match url.path().find(\"base64,\") {\n                        Some(v) => v,\n                        None => {\n                            bail!(\"failed to parse inline source map: not base64: {url:?}\")\n                        }\n                    };\n\n                    let content = url.path()[idx + \"base64,\".len()..].trim();\n\n                    let res = BASE64_STANDARD\n                        .decode(content.as_bytes())\n                        .context(\"failed to decode base64-encoded source map\")?;\n\n                    Ok(Some(sourcemap::SourceMap::from_slice(&res).context(\n                        \"failed to read input source map from inlined base64 encoded string\",\n                    )?))\n                };\n\n            let read_file_sourcemap =\n                |data_url: Option<&str>| -> Result<Option<sourcemap::SourceMap>, Error> {\n                    match &**name {\n                        FileName::Real(filename) => {","sourceCodeStart":434,"sourceCodeEnd":470,"githubUrl":"https://github.com/swc-project/swc/blob/5176682b65416c6b5de6b47379ae1588ea3ecb3f/crates/swc/src/lib.rs#L434-L470","documentation":"While reading an inline input source map, swc parsed the `sourceMappingURL=data:...` URL successfully but its path lacks the `base64,` marker, so there is no base64 payload to decode (crates/swc/src/lib.rs). SWC only supports the standard base64-encoded inline form, `data:application/json;base64,...`. A malformed URL would fail earlier with a different message ('failed to parse inline source map url').","triggerScenarios":"A compiled input file whose last line is `//# sourceMappingURL=data:application/json;charset=utf-8,{...raw JSON...}` (URI-encoded, not base64) or any data-URL map emitted without base64. Read during process_js_file/get_orig_src_map when input source maps are enabled.","commonSituations":"Hand-authored sourceMappingURL comments; tools/minifiers emitting non-standard non-base64 data URIs; pasting raw sourcemap JSON into the comment; concatenated bundle artifacts with mangled comments.","solutions":["Re-emit the inline map base64-encoded: `//# sourceMappingURL=data:application/json;base64,` + base64 of the map JSON","Or move the map to an external file and reference `//# sourceMappingURL=index.js.map`","If the input map is unneeded, delete the sourceMappingURL comment or set swc options to skip reading input maps"],"exampleFix":"// before\n//# sourceMappingURL=data:application/json,{\"version\":3,...}\n// after\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMifQ==","handlingStrategy":"validation","validationCode":"// JavaScript - check the sourceMappingURL is base64 before compiling\nfunction assertInlineMapIsBase64(source) {\n  const m = source.match(/\\/\\/[#@]\\s*sourceMappingURL=data:([^,]*)/);\n  if (m && !m[1].includes('base64')) {\n    throw new Error('sourceMappingURL data URI must be base64-encoded');\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Emit inline maps with data:application/json;base64, only","Validate upstream tooling that rewrites sourceMappingURL comments","Prefer external .map files when you control the build"],"tags":["swc","source-map","base64","data-url","sourcemappingurl"],"backgroundTag":"invalid-inline-sourcemap","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"}