# Automatic crash fixes: from a production error to a pull request

[Learn](/learn) › What Bugstack does

# Automatic crash fixes: from a production error to a pull request

When your app throws an error nobody caught, Bugstack hears about it, finds the cause in your code, proves a fix in a sandbox and opens a pull request. Nobody has to notice the crash, file a ticket or describe the problem. You review a finished fix.

## The problem this solves

Every team has a crash that has been open for weeks. It is not urgent enough to drop everything for, so it waits, and users keep hitting it. The fix is often one line. What takes the time is noticing it, finding the cause, proving the fix and getting it through review.

Bugstack does [autonomous software maintenance](/autonomous-software-maintenance). Crash fixes are the job it was built around.

## What happens, step by step

1.  **Your app reports the error.** The Bugstack SDK sends the error, its stack trace and the route. Repeats of the same error are grouped into one problem.
2.  **Bugstack assigns the work.** A coordinator hands the problem to two specialists: a tester and a fixer.
3.  **The tester reproduces the crash.** In an isolated sandbox, with the network cut, it writes a test that fails on your current code for the bug’s own reason.
4.  **The fixer writes the change.** The test has to pass and the rest of your suite has to stay green. If a fix does not hold, it tries again, and a fix that never holds opens no pull request.
5.  **A pull request opens.** It says what happened, why it broke, what the change does, how to check it, and the risk. It carries the test. Your CI runs on it.
6.  **It lands the way you chose.** On Review you merge it. On Autopilot it merges once your proof setting is met.
7.  **Bugstack keeps watching.** A change it merged is watched for a day. If the crash comes back, it opens a pull request that reverts the change.

## What a fix looks like

This is from a real Bugstack pull request on our own repository:

-   **What happened:** an upload request got an HTML error page back from another service, and the whole page was reported as the error message.
-   **Why it broke:** one line wrapped any non-JSON reply as the error text.
-   **What it changes:** one line, so the message reads “Upstream 502” when the reply is a web page.
-   **Proof:** a new test fails without the change and passes with it, and the other 674 tests still pass.

It opened at 21:21 and merged at 21:31, on a repository set to Autopilot.

## What it works with

Language

Frameworks the SDK supports

JavaScript and TypeScript

Next.js route handlers, Express, any Node process

Python

Django, Flask, FastAPI

Ruby

Rails, Sinatra, any Rack app

Go

net/http, Gin, Echo

The sandbox proves fixes for Python, JavaScript, TypeScript and Go test suites. A Ruby fix opens as a pull request for your review.

## What it does not do

-   It works from errors on your server. Errors in your users’ browsers are not covered.
-   It fixes crashes. A wrong answer that returns normally gives it nothing to act on.
-   A crash caused by something outside your code, such as a database that is down, is reported and gets no code change.

## How to start

1.  Sign in with GitHub and start the 14-day trial. It includes $50 of credit.
2.  Install the Bugstack GitHub App on your repository.
3.  Add the SDK for your language. It is a few lines.

New repositories start on Review, so nothing merges until you merge it.

## Questions

### How does Bugstack know about a crash?

Your app tells it. The SDK reports uncaught server errors as they happen, with the stack trace and the route.

### What if the fix is wrong?

It is a pull request, so it meets the same checks as any change: a reproducing test, your CI and, on Review, you. If a merged fix turns out wrong, undo opens a revert pull request.

### Does the SDK slow my app down?

The SDK reports an error after it has happened and does not wait on Bugstack to answer your user. If Bugstack cannot be reached, the report is retried a few times and then dropped.

## Related

-   [Fixing a failing CI build automatically](/learn/fix-failing-ci)
-   [Fixing a failed deploy automatically](/learn/fix-failed-deploys)
-   [How to verify AI-generated code before it merges](/learn/verify-ai-generated-code)
-   [What is autonomous software maintenance?](/autonomous-software-maintenance)

## See it work on your own code.

$100 a month

Includes $100 of usage credit every month. Start with a 14-day trial: $50 of credit and a first security audit on us. A card is required.

[Get started](https://dashboard.bugstack.ai/login) [Book 15 minutes with the founder](https://cal.com/mason-bachmann-1atgdq/15min)