# Analyze a Stack Trace and Find the Root Cause

Paste a Java, Python, JavaScript, Go, Ruby, C#, Rust, or PHP stack trace to get the root cause, the first frame of your own code, and every frame parsed.

## Run it

- **CLI:** `gizza tool stack-trace-analyzer 'Exception in thread "main" com.example.SvcException: could not start
	at com.example.App.start(App.java:42)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:301)
Caused by: java.net.ConnectException: Connection refused
	at com.example.Db.connect(Db.java:17)'`
- **Web:** https://gizza.ai/tools/stack-trace-analyzer/
- **Agents:** machine-readable descriptor (parameters JSON Schema) at https://gizza.ai/tools/stack-trace-analyzer/tool.json

## Inputs

- `trace` — Stack trace _(field)_
- `language` — Language _(field)_
- `output` — Output _(field)_
- `user_packages` — Your code prefixes _(field)_
- `hide_framework` — Hide framework frames _(field)_
- `reverse` — List frames in call order _(field)_
- `limit` — Max frames per exception _(field)_

## Output

- Analysis (text)

## Query parameters

Open the tool pre-filled and auto-run via URL:

- `trace` — Stack trace
- `language` — Language
- `output` — Output
- `user_packages` — Your code prefixes
- `hide_framework` — Hide framework frames
- `reverse` — List frames in call order
- `limit` — Max frames per exception

Example: `https://gizza.ai/tools/stack-trace-analyzer/?trace=Exception%20in%20thread%20%22main%22%20com.example.SvcException%3A%20could%20not%20start%0A%09at%20com.example.App.start%28App.java%3A42%29%0A%09at%20org.springframework.boot.SpringApplication.run%28SpringApplication.java%3A301%29%0ACaused%20by%3A%20java.net.ConnectException%3A%20Connection%20refused%0A%09at%20com.example.Db.connect%28Db.java%3A17%29&language=auto&output=report&user_packages=com.example%2Cmyapp&hide_framework=true&reverse=true&limit=100`

---

## About this tool

`stack-trace-analyzer` turns a pasted crash log into a readable map of what failed. It understands common stack trace formats from Java/Kotlin/Scala, Python, JavaScript/TypeScript/Node, Go, Ruby, C#/.NET, Rust, and PHP, then reports the detected language, the reported exception, the root cause at the end of the exception chain, and the first frame that looks like your own code.

Use it when a trace is long, nested, or mixed with framework calls. The analyzer normalizes frame order so the throw or panic site appears first by default, marks each frame as **user** or **framework**, and can hide framework frames entirely when you only want the code paths you control. If automatic classification is too broad, add comma-separated **Your code prefixes** such as `com.example`, `/app/src`, or `my_service`.

### Worked example

Input:

```text
Exception in thread "main" com.example.SvcException: could not start
    at com.example.App.start(App.java:42)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:301)
Caused by: java.net.ConnectException: Connection refused
    at java.base/sun.nio.ch.Net.pollConnect(Native Method)
    at com.example.Db.connect(Db.java:17)
```

Default report highlights:

```text
Language: Java / Kotlin / Scala (auto-detected)
Reported: com.example.SvcException: could not start
Root cause: java.net.ConnectException: Connection refused
First user frame: com.example.Db.connect(Db.java:17)
```

Set **Output** to `table` for a Markdown frame table or `json` when you want a structured exception chain for another script. Enable **Hide framework frames** to drop standard-library, package-manager, runtime, and framework frames from the displayed output.

### Options and limits

- **Language** defaults to `auto`. Force a language for short or truncated traces.
- **Output** chooses readable report, Markdown table, or JSON.
- **Your code prefixes** is an allow-list. When set, only functions or file paths matching those prefixes count as user code.
- **Hide framework frames** removes framework rows from the rendered output but still counts them.
- **List frames in call order** flips the default innermost-first order to outermost-first.
- **Max frames per exception** accepts 1 through 2000; the default is 100.
- Input is capped at 200,000 bytes. Paste the failing trace rather than an entire application log.
- The parser is heuristic. It does not execute code, fetch source maps, symbolicate minified JavaScript, de-obfuscate Java class names, or reconstruct frames missing from the pasted trace.

## FAQ

<details>
<summary>Which stack trace formats does it parse?</summary>

It handles Java-style `at Class.method(File.java:42)` traces including `Caused by`, Python `Traceback` blocks, JavaScript/Node `at function (file:line:col)` traces, Go panics and goroutine frames, Ruby, C#/.NET, Rust panics/backtraces, and PHP fatal-error traces. Use the language selector when a very short snippet cannot be detected reliably.

</details>

<details>
<summary>How does it decide what is my code?</summary>

Without prefixes it uses language-specific framework rules such as Java `java.*`, Node `node_modules` and `node:internal`, Python `site-packages`, Ruby `/gems/`, Rust `/rustc/`, and .NET `System.*`. If you provide **Your code prefixes**, those prefixes become the rule: only matching function or file paths are marked as user code.

</details>

<details>
<summary>What is the root cause?</summary>

The root cause is the innermost exception in a chain: the last `Caused by` in Java, the original exception behind Python `__cause__` / context text, the deepest inner exception in .NET-style traces, or the single reported exception when there is no chain.

</details>

<details>
<summary>Can it symbolicate minified JavaScript or native crash dumps?</summary>

No. It only analyzes the text you paste. Source maps, debug symbols, minidumps, JVM heap dumps, and IDE-specific symbolication are out of scope. If the trace already contains file names, line numbers, and functions, this tool will structure and classify them.

</details>

<details>
<summary>Is the trace uploaded anywhere?</summary>

No. The same Rust parser runs locally in the WebAssembly page and in the CLI. Your stack trace is processed in your browser or terminal.

</details>

## Related tools

- [Strip accents and transliterate text to plain ASCII](https://gizza.ai/tools/accent-stripper/): Paste text and strip accents to plain ASCII. Transliterate non-Latin scripts, preserve chosen characters, lowercase, and audit unmapped output.
- [Brotli Decompress](https://gizza.ai/tools/brotli-decompress/): Paste a Brotli (.br) payload as Base64 or hex and read what's inside. Output as text, hex, or Base64, with size and ratio stats. Free, private, no sign-up.
- [Child Growth Percentile Calculator](https://gizza.ai/tools/child-growth-percentile/): Compute CDC child growth-chart percentiles and z-scores from age, sex, height, weight and head circumference. Supports metric or US units.
- [Dependency Risk Auditor](https://gizza.ai/tools/dependency-risk-auditor/): Audit a package.json, package-lock.json, yarn.lock or pnpm-lock.yaml for wildcard versions, git/URL deps, install scripts and missing integrity hashes.
- [DNA / RNA Reverse Complement](https://gizza.ai/tools/dna-reverse-complement/): Reverse-complement DNA or RNA in your browser — full IUPAC ambiguity codes, FASTA records, preserved case, complement-only and reverse-only modes. No upload.
