{"record":{"id":"d8690932f7e44133","repo":"parcel-bundler/parcel","slug":"source-map-not-found","errorCode":null,"errorMessage":"Source map not found","messagePattern":"Source map not found","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/reporters/dev-server/src/HMRServer.js","lineNumber":619,"sourceCode":"    if (filePath.startsWith('/') || path.isAbsolute(filePath)) {\n      filePath = path.normalize(filePath);\n    } else {\n      filePath = path.join(distDir, filePath);\n    }\n\n    // If the file is inside the distDir, it's a bundle path.\n    if (isDirectoryInside(filePath, distDir)) {\n      return {type: 'bundle', filePath: filePath};\n    }\n\n    // Otherwise, assume this refers to a source file.\n    // This can happen if the server uses --enable-source-maps,\n    // in which case Node will have already mapped the location.\n    if (isDirectoryInside(filePath, this.options.projectRoot)) {\n      return {type: 'source', filePath};\n    }\n\n    throw new Error('Source map not found');\n  }\n}\n\nfunction getSpecifier(dep: Dependency): string {\n  if (typeof dep.meta.placeholder === 'string') {\n    return dep.meta.placeholder;\n  }\n\n  return dep.specifier;\n}\n\nfunction getCodeFrame(\n  line: number,\n  column: number,\n  source: string,\n  contextLines: number,\n  language: string,\n): string {","sourceCodeStart":601,"sourceCodeEnd":637,"githubUrl":"https://github.com/parcel-bundler/parcel/blob/59484858a1a0bcbb71f74088956bb437a2db6505/packages/reporters/dev-server/src/HMRServer.js#L601-L637","documentation":"Thrown by HMRServer.findSourceMap after every classification branch has been exhausted. The method maps an incoming path to one of three location types: 'bundle' if inside distDir, 'source' if inside projectRoot, otherwise it throws. So the file the client asked a source map for is neither in the build output nor inside the project tree.","triggerScenarios":"A source-map request whose filePath, after stripping publicUrl / file:// / rsc:// prefixes and normalizing, resolves to an absolute path outside both distDir and projectRoot. Commonly a stack frame from a dependency resolved outside the project (e.g. in a global node_modules) or a path that lost its leading slash through URL handling.","commonSituations":"Stack frames pointing into a globally-installed package or a pnpm virtual store outside projectRoot; symlinked source roots not under projectRoot; misconfigured publicUrl that leaves the path malformed; rsc:// URL parsing edge cases where the pathname slice yields a bogus path.","solutions":["Compare the failing filePath against your projectRoot and distDir; if it legitimately belongs to the project, make sure it is under projectRoot (or extend projectRoot).","Verify publicUrl is set correctly so prefix stripping does not corrupt the path.","If the frame is from an external dependency, expect Parcel to decline — that is correct behavior; remap externally or ignore.","For symlinked monorepo packages, ensure the real path resolves under projectRoot (configure packageManager/workspace roots)."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Confirm a path lives in projectRoot or distDir before requesting its map\nconst path = require('path');\nfunction isCovered(filePath, projectRoot, distDir) {\n  const rel = path.relative(projectRoot, filePath);\n  const inProject = rel && !rel.startsWith('..');\n  const inDist = !path.relative(distDir, filePath).startsWith('..');\n  return Boolean(inProject || inDist);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep all source under projectRoot; avoid resolving sources into global node_modules.","Set publicUrl consistently so HMRServer's prefix stripping yields a valid in-project path."],"tags":["hmr","dev-server","source-maps","path-resolution"],"backgroundTag":null,"analyzedSha":"59484858a1a0bcbb71f74088956bb437a2db6505","analyzedAt":"2026-08-13T04:06:35.925Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}