On this page
- The most common coding errors, ranked
- The three textbook types, measured
- Every type of coding error, with examples
- Logic errors
- Syntax and compile errors
- Type errors
- Null, nil and undefined values
- Off-by-one and boundary errors
- Crashes and unhandled exceptions
- Concurrency errors: races and deadlocks
- Memory and resource leaks
- Error handling bugs
- Performance bugs, hangs and timeouts
- Parsing, encoding and input validation
- State, cache and data consistency
- Date, time and timezone
- Integration and environment errors
- Security bugs
- Coding errors by language
- How to fix a coding error
- How to catch each type of coding error
- Where repowise fits
- How we measured
- FAQ
A coding error is a mistake in source code that stops a program from compiling, makes it fail while it runs, or makes it produce the wrong result. Textbooks sort them into three types: syntax errors, runtime errors and logic errors. We counted which ones actually get fixed in real code. Across 106,106 bug-fix commits in 290 popular open-source repositories, wrong-result bugs are the largest group by far (41.69% of fixes that name a cause, with plain logic errors the top single type at 14.80%), integration and environment errors come second (24.43%), runtime failures third (17.06%), and syntax and type errors are only 9.88%.
That ranking is close to the reverse of how most "types of errors" articles spend their words. Syntax errors get the most attention because they are the first thing a beginner hits. They are also the cheapest to catch: the compiler, the type checker or the linter stops them before the code is committed. The bugs that survive into git history, and cost a fix commit later, are mostly the ones no tool flagged.
The most common coding errors, ranked
We classified each bug-fix commit by the cause its message names. Logic errors (wrong behaviour) are the most common single type, at 14.80% of named-cause fixes, followed by UI and rendering bugs and build and configuration errors. Each repo counts equally in the share column, so one repo with 10,000 commits cannot set the ranking.
| Coding error type | Fix commits | Share of named-cause fixes | Repos where it appears |
|---|---|---|---|
| Logic errors (wrong behaviour) | 9,865 | 14.80% | 248 |
| UI and rendering | 7,350 | 10.68% | 224 |
| Build, CI and configuration | 4,711 | 9.25% | 237 |
| API, network and integration | 4,620 | 8.01% | 220 |
| Parsing, encoding and input validation | 4,524 | 7.74% | 236 |
| Platform and compatibility | 3,375 | 7.17% | 221 |
| State, cache and data consistency | 4,866 | 7.05% | 232 |
| Test and flaky-test fixes | 3,595 | 5.24% | 195 |
| Syntax and compile errors | 3,445 | 5.15% | 214 |
| Type errors | 3,006 | 4.73% | 202 |
| Concurrency (races, deadlocks) | 1,742 | 3.58% | 194 |
| Crashes and unhandled exceptions | 1,977 | 3.20% | 186 |
| Error handling | 1,559 | 3.04% | 179 |
| Performance, hangs and timeouts | 1,128 | 2.20% | 179 |
| Null, nil and undefined values | 1,537 | 1.99% | 154 |
| Off-by-one and boundary errors | 1,000 | 1.98% | 160 |
| Security | 768 | 1.69% | 130 |
| Date, time and timezone | 987 | 1.42% | 125 |
| Memory and resource leaks | 546 | 1.07% | 118 |
Scroll the table sideways to see every column.
Shares are the average across the 223 repos with at least 20 named-cause fixes. Fix counts are totals across all 290 repos.
Three things stand out:
- Logic beats crashes. Code that runs and quietly does the wrong thing gets fixed far more often than code that falls over. Runtime failures of every kind, from crashes to races, are 17.06%.
- The famous bugs are rare. Null references and off-by-one errors are the classic interview examples, and each is about 2% of named-cause fixes. Strict type checking and collection iterators remove many of both before they reach a commit.
- The environment is a quarter of the work. Build and configuration, platform differences and network integration add up to 24.43% of named-cause fixes, more than every runtime category combined.
The three textbook types, measured
Group the 19 categories into the textbook buckets and the picture is clear. Wrong-result bugs are 41.69% of named-cause fixes; errors caught before the code runs are 9.88%.
| Group | What it covers | Share of named-cause fixes |
|---|---|---|
| Wrong result (logic errors) | Logic, UI and rendering, parsing and validation, state and cache, date and time | 41.69% |
| Integration and environment | Build, CI and configuration, API and network, platform and compatibility | 24.43% |
| Runtime failures | Crashes, null values, off-by-one, concurrency, leaks, hangs, error handling | 17.06% |
| Caught before the code runs | Syntax, compile and type errors | 9.88% |
| Tests | Broken and flaky tests | 5.24% |
| Security | Injection, path traversal, XSS, vulnerable code | 1.69% |
Scroll the table sideways to see every column.
The textbook list misses the second row entirely. A build that breaks on Windows, a config key that changed name, or a client that sends the wrong header is not a syntax, runtime or logic error in the classic sense, and in real repositories it is one named-cause fix in four.
Every type of coding error, with examples
Each section below gives a definition, a minimal example, real fix messages from the dataset, and the tool that catches it. The fix messages are quoted as written, from the repos named, with PR numbers trimmed.
Logic errors
A logic error is code that compiles and runs without failing but produces the wrong result. It is the most common coding error in our data (14.80% of named-cause fixes, and 41.69% for the wider wrong-result group) and the hardest to catch, because nothing tells you it happened.
def is_weekend(day: int) -> bool: # 0 = Monday ... 6 = Sunday
return day > 5 # bug: Saturday (5) returns False
# fix: return day >= 5
Real examples of logic errors from the fixes we classified:
- grafana/grafana: "heatmap: fix prometheus buckets sorting"
- apache/airflow: "Fix Gantt view still visible when time range is outside dagrun window"
- microsoft/powertoys: "Fix select result when there is no results"
How to catch it: tests that assert on outputs, beyond checking that the code runs. Unit tests on the branch conditions, property-based tests for calculations, and code review that asks "what should this return for X". Our test coverage guide covers which tests find which bugs.
Syntax and compile errors
A syntax error breaks the grammar of the language, so the code never runs. In committed code they are 5.15% of named-cause fixes, and the ones that get there are compiler warnings and broken imports more than a plain missing colon.
def total(items)
return sum(items)
# SyntaxError: expected ':'
From the data:
- apache/airflow: "Fix SecretCache import error in Python 3.14 with pytest-xdist"
- bevyengine/bevy: "Fix clippy when
target_os = "windows"" - grafana/grafana: "Toolkit: Fix script failures due to missing import paths"
How to catch it: the compiler, and a linter in the editor, pre-commit and CI.
Type errors
A type error uses a value as the wrong kind of thing: a string where a number is expected, or a property that does not exist on that type. They are 4.73% of named-cause fixes, and 8.0% in Python repos, where most type checking is optional.
function pageCount(total: number, perPage: number) {
return Math.ceil(total / perPage);
}
pageCount("120", 20);
// error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.
In the wild:
- grafana/grafana: "Insights: Fix optional
buildInfotype" - langchain-ai/langchain: "Fix UnionType type var replacement"
How to catch it: a static type checker (TypeScript in strict mode, mypy or Pyright) in CI. See what static code analysis catches for where type checking sits next to other static checks.
Null, nil and undefined values
A null error reads a value that is not there: a null pointer, undefined, None or a missing key. Tony Hoare called the null reference his billion-dollar mistake. In our data it is 1.99% of named-cause fixes, and it still appears in 154 of the 290 repos.
const user = users.find((u) => u.id === id);
return user.name;
// TypeError: Cannot read properties of undefined (reading 'name')
From the data:
- temporalio/temporal: "Fix NPE when emit duplicated replication task metrics"
- apache/airflow: "fix: add null checks for dag_version access in scheduler"
- grafana/grafana: "Authz: Fix zookie nil pointer dereference"
How to catch it: strict null checking in the type system (strictNullChecks in TypeScript, Kotlin's nullable types, Optional in Python type hints), and tests for the "not found" path.
Off-by-one and boundary errors
An off-by-one error is a loop, index or range that is one step too long or too short, and boundary errors are its relatives: overflow, truncation and rounding at the edges. They are 1.98% of named-cause fixes.
for i in range(1, len(items)): # skips items[0]
process(items[i])
# fix: for item in items: process(item)
Seen in real repos:
- bevyengine/bevy: "Fix overflow panic on Stopwatch at Duration::MAX"
- redis/redis: "Fix off-by-one in listpack backlen encoding"
- gin-gonic/gin: "fix(context): panic on NegotiateFormat - index out of range"
How to catch it: tests at the edges (empty, one item, the maximum), iterating over collections instead of indexes, and property-based tests that generate boundary values.
Crashes and unhandled exceptions
A runtime crash is an error the program does not handle, so it panics, throws or segfaults. Crashes with no more specific cause are 3.20% of named-cause fixes, and 9.0% in C++ repos.
From the data:
- go-gitea/gitea: "fix: avoid markup render panic"
- microsoft/powertoys: "[Peek]Fix crash while loading thumbnails for small pngs"
- bevyengine/bevy: "Fix panic in update_viewport_render_target_size when despawning"
How to catch it: crash reporting in production, fuzzing for parsers and input handlers, and tests that feed malformed input.
Concurrency errors: races and deadlocks
A race condition is two threads or tasks touching shared state in an order nobody planned; a deadlock is two of them waiting on each other forever. They are 3.58% of named-cause fixes, and they show up in 194 repos.
var hits int
for range urls {
go func() { hits++ }() // data race: unsynchronized write
}
// go test -race reports it; fix with sync/atomic or a mutex
In the wild:
- docker/compose: "Fix concurrent map read/write when recreating containers"
- temporalio/temporal: "Fix race in fairTaskReader"
- microsoft/powertoys: "[FancyZones] Fix deadlocks in ZoneWindowDrawing"
How to catch it: race detectors (go test -race, ThreadSanitizer), stress tests that run the same test many times, and review of any shared mutable state.
Memory and resource leaks
A resource leak holds memory, a file handle, a goroutine or a connection after it is no longer needed, until the process runs out. They are the rarest category in the table (1.07%).
f = open(path)
data = f.read() # if read() raises, f is never closed
# fix: with open(path) as f: data = f.read()
From the data:
- redis/redis: "Fix memory leak in trackingRememberKeys() for PUBSUB commands"
- grafana/grafana: "Middleware: Fix goroutine leak when gzip compression is enabled"
- apache/airflow: "Fix /tmp file leak when API server streams large task logs"
How to catch it: scoped resource handling (with, defer, using, RAII), leak detectors and sanitizers, and memory graphs on long-running services.
Error handling bugs
An error-handling bug is code that catches an error and then does the wrong thing with it: swallows it, reports the wrong message, or retries forever. They are 3.04% of named-cause fixes.
Seen in real repos:
- apache/airflow: "Fix DAG run trigger to surface errors instead of swallowing them"
- go-gitea/gitea: "Fix environments for KaTeX and error reporting"
How to catch it: linters that flag empty catch blocks and ignored errors (errcheck in Go, Ruff's BLE and S110 rules in Python), and tests that force the failure path.
Performance bugs, hangs and timeouts
A performance bug makes code correct but too slow, or makes it hang. They are 2.20% of named-cause fixes.
From the data:
- microsoft/powertoys: "Fixing issues when color picker freezes"
- apache/airflow: "Fix LocalExecutor memory spike by applying gc.freeze"
How to catch it: benchmarks in CI for hot paths, timeouts on every network call, and profiling before and after a change.
Parsing, encoding and input validation
A parsing bug mishandles the shape of incoming data: a quote, a newline, a Unicode character, a malformed JSON payload. They are 7.74% of named-cause fixes, and 11.0% in Python repos.
In the wild:
- tobymao/sqlglot: "Fix Hive PARTITION parsing"
- rails/rails: "Fix
strip_tagsto encode"and'in its output" - langchain-ai/langchain: "fix(core): allow deserializing
RunnablePick"
How to catch it: schema validation at every trust boundary, fuzzing, and test fixtures built from real malformed inputs.
State, cache and data consistency
A state bug leaves data stale, duplicated or out of sync: a cache that is never invalidated, a migration that runs twice, a record written half-way. They are 7.05% of named-cause fixes.
From the data:
- go-gitea/gitea: "Fix duplicate migrated milestones"
- grafana/grafana: "CloudWatch: fix duplicated IDs"
How to catch it: database constraints (unique keys, foreign keys) over application checks, explicit cache invalidation rules, and integration tests against a real database.
Date, time and timezone
A time bug assumes a timezone, a calendar or a clock that the user does not have. They are 1.42% of named-cause fixes.
from datetime import datetime, timezone
datetime.now() # naive local time, differs per server
datetime.now(timezone.utc) # aware, comparable everywhere
Seen in real repos:
- apache/airflow: "fix(ui): Calendar view respects user-selected timezone"
- tobymao/sqlglot: "Fix(bigquery): preserve time zone info in FORMAT_TIMESTAMP roundtrip"
How to catch it: store UTC, convert at the edge, and run tests under a non-UTC timezone and across a DST change.
Integration and environment errors
Integration and environment errors are code that is correct on the author's machine and wrong somewhere else: another OS, another browser, another version of a dependency, or another service. Build and configuration (9.25%), API and network (8.01%) and platform (7.17%) together make this the second-largest group.
From the data:
- grafana/grafana: "Plugins: Fix plugin signature calculation not working on Windows"
- bevyengine/bevy: "Fix dynamic linking (on linux)"
- apache/airflow: "Fix incorrect asset queued-event endpoint paths in airflowctl"
How to catch it: a CI matrix across the operating systems and runtime versions you support, contract tests for every API you call, and configuration validated at startup.
Security bugs
A security bug lets an attacker read, change or run something they should not. They are 1.69% of named-cause fixes, and appear in 130 repos.
In the wild:
- apache/airflow: "fix: block path traversal via ".." in dag_id and run_id"
- grafana/grafana: "fix XSS vulnerabilities in dashboard links"
How to catch it: security-focused static analysis (Semgrep, CodeQL), dependency scanning, and review of every place untrusted input reaches a query, a path or HTML.
Coding errors by language
The language changes the mix more than the ranking: logic errors are in the top three in all nine languages with enough data, and first or second in eight. Shares below are within each language, and they reflect the repos in it as much as the language itself.
| Language | Repos | Named-cause fixes | Top error types |
|---|---|---|---|
| Python | 84 | 16,974 | Logic 19.1%, parsing 11.0%, API 8.1%, type 8.0% |
| TypeScript | 65 | 15,541 | UI 17.6%, logic 15.4%, state 9.9%, API 8.3% |
| Go | 30 | 6,319 | Logic 16.2%, UI 12.7%, build 9.3%, state 8.45% |
| Java | 7 | 3,974 | Logic 13.1%, API 13.0%, tests 11.9%, state 9.4% |
| Rust | 21 | 3,792 | UI 20.5%, logic 14.0%, syntax and compile 9.7% |
| JavaScript | 27 | 3,607 | Logic 12.4%, build 12.2%, syntax 9.7%, UI 8.8% |
| C | 7 | 2,081 | UI 16.4%, build 14.7%, logic 13.1%, crashes 8.7% |
| C++ | 14 | 1,048 | Logic 21.6%, crashes 9.0%, build 8.2% |
| C# | 10 | 657 | Logic 16.4%, UI 11.6%, build 9.7%, API 9.7% |
Scroll the table sideways to see every column.
A few patterns hold up. Python, with optional types, has the highest share of type errors of any language (8.0%). Java, home of the NullPointerException, has the highest null share (6.0%). C and C++ have the highest crash shares, which is what manual memory management predicts. Rust's high UI share comes from its GUI, terminal-UI and game-engine repos, and its syntax-and-compile share reflects how much the compiler and Clippy demand.
The share of all commits that are bug fixes also varies: 24.19% in Python repos, 21.45% in TypeScript, 18.21% in Go and 12.60% in C#. Across all 263 repos with at least 100 commits, the median is 20.40%.
How to fix a coding error
To fix a coding error, read the error message and the line it names, reproduce the failure, then shrink the input until only the cause is left. Syntax and type errors usually stop there: the message points at the line. Runtime errors come with a stack trace, so start at the deepest frame in your own code. Logic errors give you no message, so write a failing test that pins the wrong output first, then step through with a debugger or log the values at each branch. If the bug is new, git bisect finds the commit that introduced it in a handful of steps. Keep the failing test after the fix so the same bug cannot come back.
How to catch each type of coding error
No single tool catches every type of coding error; each layer catches a different slice. The cheapest checks catch the rarest bugs in committed code, which is why the expensive bugs are the ones left.
| Check | Catches | Misses |
|---|---|---|
| Compiler and linter | Syntax, unused code, many error-handling patterns | Logic, environment, most runtime bugs |
| Type checker | Type errors, most null errors | Logic, concurrency, environment |
| Static analysis | Null paths, injection, leaks, some races | Logic that depends on intent |
| Unit and property tests | Logic, off-by-one, parsing, time | Environment, concurrency |
| Integration tests and CI matrix | API, platform, build, state | Rare races |
| Race detectors and fuzzers | Concurrency, crashes, parsing | Logic |
| Code review | Logic, security, intent mismatches | Anything the reviewer does not open |
Scroll the table sideways to see every column.
The pattern in the data points to two habits. First, put tests and review where the bugs actually land: the files that keep getting bug-fixed. Our study of code health flags against bug fixes found that the least healthy fifth of a repo's files held 55% of the files with a recent bug fix, even with the score's own bug-fix input taken out. Second, treat the environment as code: a CI matrix and config validation catch the quarter of bugs that no unit test sees.
For the wider picture of how these checks fit together, see the code quality guide.
Where repowise fits
repowise runs the same fix keyword rule on your own repository, then checks each fix's diff so only changes to production code count. It counts the bug-fix commits that touched each file and function over the last six months, flags bug magnets (files with a recent run of fixes), and feeds that history into the code health score. When an AI coding agent is about to edit a file with a recent run of fixes, repowise tells it before it edits. The bug-fix history docs cover the details.
How we measured
We classified the subject line of every bug-fix commit in the indexed history of 290 public GitHub repositories with 1,000+ stars, using a fixed keyword taxonomy. Every number on this page comes from that classification.
- Repositories. Every public repository with 1,000+ GitHub stars that has a live index on repowise.dev (348), the same pool behind our State of Open-Source Code Health 2026 dataset. We left out 44 whose index has no commit feed, 13 whose primary language is markup or unknown and one mirror of another repo, which leaves 290 repos in 21 primary languages, indexed between May and November 2026.
- Commits. 501,013 commits from the indexed history of those repos (a median of 500 per repo), with fix commits deduplicated by SHA so shared history counts once. 57.84% of the fix commits are from 2025 or 2026.
- What counts as a bug fix. repowise's fix rule: the subject contains
fixor one of its forms (fixed,fixes,hotfix,bugfix),bug,patch,resolves,closes #Norfixes #N, and none ofdocs,typo,bump,deps,chore,lint,formatorstyle. That gave 106,106 fix commits. We then set aside reverts (463), release labels such ascore[patch]: Release 0.2.23(403) and fixes to documentation and content (6,279), leaving 98,961 code-bug fixes. - Classification. Each subject gets one label: the first of 19 categories whose keyword pattern matches, ordered from specific causes (security, leaks, races, null values) to general ones (logic). A conventional-commit prefix such as
fix(parser):and issue numbers are removed first. 61.24% of code-bug fixes name a cause the taxonomy recognises; messages such as "fix #1234" or "bug fixes" stay unclassified and are left out of the shares. - Repo weighting. Category shares are averaged across the 223 repos with at least 20 named-cause fixes, so each repo counts once. The per-language table pools fixes within each language.
- Checking the labels. A second reader labelled a stratified sample of 380 audited commits (340 classified, 40 unclassified) blind, without seeing our label. It put 71.3% in the same group as our rule. 96.1% of the sample were read as naming a real code cause.
- What it counts. Bugs that reached a commit and were fixed in a later commit whose message says so. Errors caught by the compiler or a reviewer before the commit are, by design, not in git history.
The scripts and raw outputs (repo list, per-commit labels, audit sample and results) are kept with the study data. The keyword taxonomy is a few dozen regular expressions, and the same approach runs on any git history.
FAQ
- What are the types of coding errors?
- The three classic types are syntax errors (the code breaks the language's grammar and will not run), runtime errors (the code fails while running, for example a crash or null reference) and logic errors (the code runs but gives the wrong result). In real repositories a fourth group matters as much: integration and environment errors, such as a build that fails on one operating system or a wrong API call, which were 24.43% of the bug fixes we classified.
- What are 5 types of errors in programming?
- A common list of five is syntax errors, runtime errors, logic errors, compilation errors and resource errors such as memory leaks. In our data from 106,106 bug fixes, the five most common specific types were logic errors, UI and rendering bugs, build and configuration errors, API and network errors, and parsing and input-validation errors.
- What are the most common coding errors?
- Logic errors are the most common coding error in real code: in 290 popular open-source repositories they were 14.80% of bug fixes that name a cause, and the wider wrong-result group was 41.69%. Build and configuration errors, API errors and parsing errors follow. Null references and off-by-one errors are each about 2%.
- What is an example of a logic error?
- A logic error is code that runs without failing but returns the wrong answer. A function meant to check for weekends that returns
day > 5instead ofday >= 5misses Saturday, and nothing crashes. A real one from grafana/grafana: "heatmap: fix prometheus buckets sorting". The chart rendered, and the buckets came out in the wrong order. - What is the difference between a syntax error and a logic error?
- A syntax error breaks the rules of the language, so the compiler or interpreter refuses to run the code and tells you where. A logic error follows every rule, so the code runs, but it does the wrong thing and nothing reports it. Syntax errors are caught in seconds by tools; logic errors need tests and review, which is why they make up far more of the fixes in real git history.
- How do you check code for errors?
- Use layers: a linter and compiler for syntax, a type checker for type and null errors, static analysis for security and resource problems, and tests for logic. Add a CI matrix for platform and configuration errors, and point review time at the files with the most past bug fixes, since that is where new ones tend to land.



