{"record":{"id":"1ba5ddbb6fe565f0","repo":"microsoft/TypeScript","slug":"no-sourcemap-files-should-be-generated-if-inlineso","errorCode":null,"errorMessage":"No sourcemap files should be generated if inlineSourceMaps was set.","messagePattern":"No sourcemap files should be generated if inlineSourceMaps was set\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/harness/harnessIO.ts","lineNumber":868,"sourceCode":"\r\n                lastIndexWritten ??= -1;\r\n                if (lastIndexWritten + 1 < codeLines.length) {\r\n                    if (!((lastIndexWritten + 1 < codeLines.length) && (codeLines[lastIndexWritten + 1].match(/^\\s*[{|}]\\s*$/) || codeLines[lastIndexWritten + 1].trim() === \"\"))) {\r\n                        typeLines += \"\\r\\n\";\r\n                    }\r\n                    typeLines += codeLines.slice(lastIndexWritten + 1).join(\"\\r\\n\");\r\n                }\r\n                typeLines += \"\\r\\n\";\r\n                yield [checkDuplicatedFileName(unitName, dupeCase), Utils.removeTestPathPrefixes(typeLines)];\r\n            }\r\n        }\r\n    }\r\n\r\n    export function doSourcemapBaseline(baselinePath: string, options: ts.CompilerOptions, result: compiler.CompilationResult, harnessSettings: TestCaseParser.CompilerSettings): void {\r\n        const declMaps = ts.getAreDeclarationMapsEnabled(options);\r\n        if (options.inlineSourceMap) {\r\n            if (result.maps.size > 0 && !declMaps) {\r\n                throw new Error(\"No sourcemap files should be generated if inlineSourceMaps was set.\");\r\n            }\r\n            return;\r\n        }\r\n        else if (options.sourceMap || declMaps) {\r\n            if (result.maps.size !== ((options.sourceMap ? result.getNumberOfJsFiles(/*includeJson*/ false) : 0) + (declMaps ? result.getNumberOfJsFiles(/*includeJson*/ true) : 0))) {\r\n                throw new Error(\"Number of sourcemap files should be same as js files.\");\r\n            }\r\n\r\n            let sourceMapCode: string | null; // eslint-disable-line no-restricted-syntax\r\n            if ((options.noEmitOnError && result.diagnostics.length !== 0) || result.maps.size === 0) {\r\n                // We need to return null here or the runBaseLine will actually create a empty file.\r\n                // Baselining isn't required here because there is no output.\r\n                sourceMapCode = null; // eslint-disable-line no-restricted-syntax\r\n            }\r\n            else {\r\n                sourceMapCode = \"\";\r\n                result.maps.forEach(sourceMap => {\r\n                    if (sourceMapCode) sourceMapCode += \"\\r\\n\";\r","sourceCodeStart":850,"sourceCodeEnd":886,"githubUrl":"https://github.com/microsoft/TypeScript/blob/b465fdbfe175304d9b977da137b2c178ae1091d3/src/harness/harnessIO.ts#L850-L886","documentation":"Thrown by doSourcemapBaseline when options.inlineSourceMap is true but the compilation result still contains separate sourcemap files (result.maps.size > 0) and declaration maps are not enabled. With inline sourcemaps the map is embedded in the JS output, so no standalone .map files should exist.","triggerScenarios":"A test sets inlineSourceMap:true (without declaration maps) and the compiler emits one or more entries into result.maps. The check is result.maps.size > 0 && !declMaps.","commonSituations":"A compiler regression that writes separate maps despite inlineSourceMap, or a test/plugin that forces external sourcemaps. Declaration maps are the exception: when getAreDeclarationMapsEnabled is true, external .d.ts.map files are expected even with inline JS sourcemaps.","solutions":["Confirm whether declaration maps are intended — if so, enable them so declMaps is true and the check is skipped.","If declaration maps are not intended but separate maps appear, investigate the compiler's sourcemap emit path for a regression.","Inspect result.maps to see which files produced unexpected external maps."],"exampleFix":"// before — inline JS maps but external decl maps without enabling them\n// @inlineSourceMap: true\n// @declaration: true\n// after — also enable declaration maps so external .d.ts.map is expected\n// @inlineSourceMap: true\n// @declaration: true\n// @declarationMap: true","handlingStrategy":"validation","validationCode":"if (options.inlineSourceMap && !ts.getAreDeclarationMapsEnabled(options)) {\n    if (result.maps.size > 0) throw new Error(\"External maps produced under inlineSourceMap\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Do not enable plugins/transforms that force external sourcemaps when inlineSourceMap is on.","If declaration maps are needed alongside inline JS maps, enable declarationMap explicitly."],"tags":["harness","compiler-output","sourcemap","inline-sourcemap","declaration-map"],"backgroundTag":null,"analyzedSha":"b465fdbfe175304d9b977da137b2c178ae1091d3","analyzedAt":"2026-08-12T05:38:42.698Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}