parcel-bundler/parcel · info · Error

Asset does not have a source map

Error message

Asset does not have a source map

What it means

Thrown by HMRServer while symbolication of a runtime stack frame points at an asset (location.type === 'asset'). The server asks the asset for its source map via getMap(); if the asset produced no map (e.g. source maps disabled, or the asset type never emits one), the symbolication for that single frame cannot proceed. Crucially, this throw sits inside a try/catch whose handler does `continue` (HMRServer.js:500-502), so the error is swallowed per-frame and only that frame's source mapping is skipped — it does not fail the request.

Source

Thrown at packages/reporters/dev-server/src/HMRServer.js:451

            frame.fileName = normalizeSeparators(
              path.relative(this.options.projectRoot, location.filePath),
            );
          } else if (location.type === 'asset') {
            // Get source map from the asset.
            let contents = await location.asset.getCode();
            frame.compiledLines = getCodeFrame(
              frame.lineNumber,
              frame.columnNumber,
              contents,
              json.contextLines,
              location.asset.type,
            );
            frame.fileName = normalizeSeparators(
              path.relative(this.options.projectRoot, location.asset.filePath),
            );
            map = await location.asset.getMap();
            if (!map) {
              throw new Error('Asset does not have a source map');
            }
          }

          if (map && frame.lineNumber != null) {
            // Find the original location in the source map.
            let mapping = map.findClosestMapping(
              frame.lineNumber,
              frame.columnNumber,
            );
            if (mapping) {
              let sourceFileName = mapping.source;
              let source = sourceFileName
                ? map.getSourceContent(sourceFileName) || ''
                : '';
              if (mapping.original && sourceFileName) {
                frame.sourceLineNumber = mapping.original.line;
                frame.sourceColumnNumber = mapping.original.column;
                frame.sourceLines = getCodeFrame(

View on GitHub (pinned to 59484858a1)

Solutions

  1. Enable source maps for the dev target: remove `--no-source-maps`, set sourceMap: true in the target, or drop the target override.
  2. Confirm the offending asset type has a transformer that emits source maps in your .parcelrc.
  3. If you intentionally ship without source maps, ignore the dropped frame — the dev server still returns the other frames.
  4. For prod builds replayed through the dev server, switch back to a development target.

Example fix

// before: target disables source maps
{
  "targets": {
    "main": {
      "sourceMap": false,
      "context": "browser",
      "mode": "development"
    }
  }
}
// after: enable source maps for dev
{
  "targets": {
    "main": {
      "sourceMap": true,
      "context": "browser",
      "mode": "development"
    }
  }
}
Defensive patterns

Strategy: validation

Validate before calling

// In your dev server bootstrap, ensure source maps are on
const target = require('./.parcelrc.targets.json'); // your targets
for (const [name, t] of Object.entries(target)) {
  if (t.sourceMap === false) {
    console.warn(`[dev] target ${name} has sourceMap:false; stack frames will be dropped`);
  }
}

Try / catch

// Already handled internally — HMRServer wraps this in try/catch continue.
// No user action needed; the per-frame skip is by design.

Prevention

When it happens

Trigger: A browser running against the Parcel dev server throws a JS error, the devtools requests /__parcel_hmr original-stack-frame for a frame whose location resolves to an asset, and that asset's getMap() returns null/undefined. Happens when source maps are off (asset.env.sourceMap === false) or for asset kinds that Parcel does not generate maps for.

Common situations: Building with `--no-source-maps`; production-style builds served through the dev server; assets transformed by a transformer that does not emit maps (some data/asset types); requesting stack frames after disabling source maps in .parcelrc or env config.

Related errors


AI-assisted analysis of parcel-bundler/parcel@59484858a1 (2026-08-13). Data as JSON: /api/errors/a83fc259979a1784. Report an issue: GitHub.