> ## Documentation Index
> Fetch the complete documentation index at: https://docs.revolte.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Investigate and Fix a Production Bug

> Go from an error report to a root cause, a scoped fix, and regression coverage.

Bug reports rarely arrive with a root cause attached — usually it's an error message, a screenshot, or a one-line description from support. This walkthrough uses whatever context you have to trace the failure back to its source and land a fix without widening scope.

***

<div class="dotted-steps">
  <Steps>
    <Step title="Share what you know" icon="terminal">
      Open a session and pass along anything available: logs, stack traces, user reports, repro steps, or recent changes to the affected area. Don't wait until you have a full picture — a partial one is enough to start.

      ```text theme={"dark"}
      We're seeing failures when users export large reports.

      - Some users get a 500 error during export.
      - Small reports work fine.
      - Only happens on accounts with large datasets.

      Error: "Memory limit exceeded while generating report"

      Investigate the cause and propose a fix.
      ```
    </Step>

    <Step title="Let Revolte investigate" icon="sparkles">
      Before it touches any code, Revolte traces the failure through the app: locating the relevant code paths, following how data moves through the system, and checking logs and related services. Read the root cause and proposed approach it reports back with, and correct it here if something's off — the fix in the next step builds directly on this.

      ```text theme={"dark"}
      Root cause:
      The report generation service loads all records into memory
      before processing. Large accounts exceed the configured limit.

      Suggested fix:
      Process records in batches instead of loading the full dataset.
      ```
    </Step>

    <Step title="Implement and validate the fix" icon="terminal">
      If the root cause checks out, tell Revolte to go ahead — and be explicit about how you want the fix verified, not just written.

      ```text theme={"dark"}
      Implement the recommended fix.

      Requirements:
      - Preserve existing report generation behavior.
      - Optimize memory usage for large datasets.
      - Follow existing service patterns.

      Verification:
      - Run relevant tests.
      - Reproduce the original failure to confirm it's resolved.
      - Check for unintended side effects.
      - Add regression coverage where it's missing.
      ```

      Revolte works through the fix and closes the loop itself — running relevant tests, reproducing the original failure to confirm it's resolved, checking for side effects, and adding regression coverage where it's missing. If you're in the chat view, click **View changes** to open the diff on the right and follow along.
    </Step>

    <Step title="Continue investigating" icon="repeat">
      Once the fix is verified, stay in the same session rather than starting a new one — it already has the full context to look wider:

      ```text theme={"dark"}
      Check whether other report generation flows have the same
      memory issue.
      ```

      ```text theme={"dark"}
      Add monitoring around this workflow so we catch similar
      issues earlier next time.
      ```
    </Step>
  </Steps>
</div>

***

## Related

* [Trace a Workflow](/use-cases/trace-a-workflow)
* [Generate Tests](/use-cases/generate-tests)
* [Application Logs](/deployments/observability/application-logs)
