Root cause analysis

Also known as: RCA

On this page 7

Root cause analysis (RCA) is a structured investigation method that traces a software failure, defect or incident back to the underlying condition that made it possible, so that a fix removes the cause rather than only the visible symptom. In software quality, RCA turns individual failures into systemic improvements to code, tests, tooling and process.

An RCA asks not only what broke, but why the failure was able to occur and why it was not caught earlier. The answer is rarely a single line of code: it usually combines a technical fault, a missing safeguard and an organizational gap, which is why mature teams treat RCA as a learning practice rather than a search for someone to blame.

How root cause analysis works in software

Root cause analysis works by moving from an observed symptom through a chain of verified causal links until the team reaches a cause that it can change and that, once changed, would have prevented the failure. Each link must be supported by evidence such as logs, telemetry, a crash report, a commit history or a reproducible test, not by assumption.

A typical RCA follows a repeatable sequence. The team first stabilizes the system, then collects facts while they are still fresh, builds a timeline, identifies causal factors, selects the root causes and finally defines corrective and preventive actions with owners and deadlines.

StageMain activityTypical output
ContainmentRoll back, disable a feature flag or apply a workaroundService restored, impact stopped
Data collectionGather logs, metrics, traces, tickets and chat historyEvidence set preserved
TimelineOrder events from first trigger to recoveryMinute-level incident timeline
Causal analysisApply 5 whys, fishbone or fault treeCausal chain with evidence
Action planningDefine fixes for code, tests and processTracked corrective actions
VerificationConfirm that actions work and do not regressClosed RCA record
Main stages of a software root cause analysis

The distinction between proximate cause and root cause is central. A null pointer dereference may be the proximate cause of a crash, while the root cause may be an unvalidated API contract combined with missing negative tests for that input.

Common RCA techniques and when to use them

Several RCA techniques exist, and each suits a different complexity of failure. Simple, linear defects respond well to lightweight methods, while incidents involving many interacting components need techniques that capture multiple contributing causes.

TechniqueHow it worksBest suited forMain weakness
5 whysAsks why repeatedly until a fixable cause appearsSingle defects with a clear chainTends to follow only one path
Fishbone diagramGroups causes into categories such as code, people and toolsBrainstorming in a team reviewCan list causes without proving them
Fault tree analysisModels failure with AND and OR logic gatesSafety-critical or high-availability systemsTime-consuming to build
Change analysisCompares a working state with a failing stateFailures after deployments or upgradesWeak when no recent change exists
Git bisectBinary search through commits to find the first bad oneReproducible regressionsFinds the commit, not the reason
Causal factor chartingMaps events and conditions along a timelineComplex production incidentsRequires detailed data
Root cause analysis techniques compared

In practice teams combine methods. A git bisect run can isolate the commit that introduced a regression in a few steps, because it halves the search space each time, and a 5 whys session then explains why code review and automated tests let that commit through.

How RCA relates to neighboring quality practices

Root cause analysis sits between detection and prevention in the quality cycle. Bug reports, crash reports and telemetry tell a team that something is wrong, and RCA explains why, while refactoring, new tests and process changes act on the findings.

ConceptMain questionRelationship to RCA
DebuggingWhere in the code is the fault?Supplies technical evidence for the RCA
PostmortemWhat happened during the incident?Document that usually contains the RCA
Regression testingDid a change break existing behavior?Common preventive action after an RCA
Quality assuranceIs the process producing reliable software?Uses RCA trends to improve the process
Technical debtWhat past shortcuts now cost effort?Frequently appears as a contributing cause
RCA compared with related software quality concepts

Debugging and RCA are often confused. Debugging ends when the fault is fixed, whereas RCA continues until the team understands why the fault existed, why testing missed it and what would stop a similar fault in other parts of the codebase.

Running an effective RCA in practice

An effective RCA is blameless, evidence-based and time-boxed. Blameless means that the analysis focuses on systems and conditions, because people who fear punishment withhold the very details that reveal the cause. Many teams complete the written analysis within five to ten working days of a major incident, while memories and logs are still available.

Not every defect deserves a full RCA. Teams usually set explicit triggers so that effort is proportional to impact, and they record lightweight analyses for minor bugs in the issue tracker.

SituationRecommended depthReason
Customer-facing outageFull RCA with written postmortemHigh impact and likely recurrence
Data loss or security incidentFull RCA with fault treeLegal, financial and trust consequences
Escaped defect found in productionShort RCA focused on the test gapReveals weaknesses in testing
Repeated similar bugsTrend RCA across several ticketsPoints to a shared systemic cause
Minor cosmetic defectBrief note in the ticketCost of analysis exceeds benefit
Deciding how deep an RCA should go

Corrective actions should be specific, owned and verifiable. A useful rule is to include at least one action at each layer: the code fix, a test or monitor that detects recurrence, and a process or design change that lowers the probability of the whole class of defect.

Limitations and common mistakes

The main limitation of RCA is that complex software systems rarely have one single root cause. Distributed services, configuration drift and human decisions under time pressure interact, so modern practice often speaks of contributing factors instead of a single culprit.

  • Stopping at human error: concluding that an engineer made a mistake explains nothing about why the system allowed it.
  • Confirmation bias: the team settles on the first plausible theory and stops collecting evidence.
  • Action items that never close: findings without owners and deadlines produce reports, not improvement.
  • Fixing only the instance: patching one function while the same pattern remains elsewhere, which static code analysis could find.
  • Analysis paralysis: spending weeks on a low-impact bug while serious recurring issues wait.

Tracking RCA outcomes over time addresses several of these risks. When a team measures recurrence of similar incidents and the closure rate of corrective actions, it can see whether analyses actually improve software reliability.

In simple terms

Root cause analysis is what a careful mechanic does when a car keeps overheating. Topping up the coolant solves today’s problem, but finding the cracked hose that leaks solves it for good.

In software, RCA means asking why a program failed again and again until the team finds the real reason. The goal is not to find someone to blame but to change the code, the tests or the way of working so that the same problem does not come back.

A practical example

An online booking service goes down for 40 minutes on a Monday morning. Engineers restore it by rolling back the latest release, then begin a root cause analysis. Logs show that the database connection pool was exhausted, and a git bisect run points to a new reporting query added in the release.

Asking why repeatedly reveals more. The query lacked an index, the load test used a small sample database, and the review checklist did not cover query plans. The team adds the index, expands the load test with production-sized data, adds an alert on connection pool usage above 80 percent and updates the review checklist. Over the next six months, no similar outage recurs.