How to Decode a Minified JavaScript Stack Trace With Source Maps
Turn app.min.js:1:48213 into the real file, line and code: how source maps work, where to find them and how to decode production errors safely.

Every front-end developer meets this error report sooner or later: a TypeError in production, and a stack trace that says the problem is in app.3f9a1c.min.js at line 1, column 48,213, inside a function called r. The trace is accurate, but it describes code nobody wrote. Minifiers squeeze an entire application onto a handful of lines and rename variables to single letters, so the position means nothing until it is translated back into the original source.
What a source map is
When a bundler such as Vite, webpack, esbuild or Rollup writes the minified file, it can also write a companion file ending in .map. That JSON file lists the original source files, optionally includes their full text, and contains a long string called mappings. The mappings string is a compact table: for each segment of each generated line it records which original file, line and column produced it, encoded as Base64 variable-length numbers. Browser developer tools read this table automatically when you open the console with the map available. Error reports from real users, however, arrive as plain text, so you have to do the lookup yourself.
Producing maps without exposing your code
You do not have to publish your source to decode errors. Most bundlers have a hidden mode: the .map files are written to the build folder, but the bundle does not contain the sourceMappingURL comment that tells browsers where to fetch them. Keep those files with the build artefacts in your CI system or a private bucket, and use them only when an error needs investigating. The important rule is that the map must come from exactly the same build as the code that failed. A map from yesterday's build will point to the wrong places, because every change moves the columns after it.
Decoding a trace step by step
Open the JavaScript Stack Trace Source Map Decoder and start by loading maps. Drop the .map files for the bundles that appear in the trace; for a code-split app that may be the main bundle plus one or two chunks. If you only have the minified script and it carries an inline map at the bottom, open the script itself and the map is extracted for you.
Next, paste the trace. Chrome, Edge and Node.js write frames as at functionName (url:line:column), while Firefox and Safari write functionName@url:line:column. Both work, and lines that are not frames, such as the error message, are kept in place. The counters immediately show how many frames were found and how many were mapped. If some frames stay unmapped, the tool lists the script names that no map matched, which usually means a missing chunk map or a third-party script.
For each mapped frame you now see the original file, line and column, and, when the map includes sourcesContent, a few lines of the original code with a caret under the exact column. That view is often enough to understand the bug without opening your editor. Finally, copy the rewritten trace, which has original paths in place of the minified ones, into the issue so everyone on the team sees the readable version.
Reading the results with care
A source map maps positions, not meaning. The function name in each frame still comes from the trace, and the map may record an original symbol at that position, which at a call site is often the name of the function being called rather than the one you are in. Treat the file and line as the solid fact and the symbol as a helpful hint.
Columns deserve a word too. Stack traces count lines and columns from 1, while maps store them from 0. The decoder converts between the two, so the numbers you see match what your editor shows.
Common reasons a frame does not map
- The map is from a different build. Check the hash in the file name or the build ID.
- The frame belongs to code you do not control, such as an analytics tag, an advertising script or a browser extension.
- The column points before the first mapping on that line, which can happen with injected wrapper code.
- The bundler chain lost the map at one step, for example a post-processing tool that did not pass maps through.
Privacy
Source maps can contain your entire codebase. The decoder runs in your browser tab and does not upload maps or traces anywhere, so it is safe to use with private code. You can even load the page, disconnect from the network and keep working.
Decoding a trace takes under a minute once the maps are at hand, and it turns vague production reports into concrete lines of code you can fix.



