The One-Line Patch That Kept a Nation's Election Software Alive

Archi4 min read

opensourceelectionssoftwaregovernance

Contents
  1. The line nobody read
  2. What the patch changed, and what it did not
  3. Why one line beat a task force
  4. The opinion, stated plainly
  5. The catch that open source advocates skip
  6. What other projects should copy

The line nobody read#

In the spring of 2023, a county clerk in Colorado opened a bug report against OpenTally, a small open source vote-counting library used by a handful of local election offices. The report was short: when a ballot contained a write-in candidate whose name differed from a registered candidate only by a trailing space, the tool grouped both entries into a single tally. The clerk found it because a school board race had come down to 11 votes, and one of them looked wrong on the printout.

The lead maintainer, a contractor in Berlin who had inherited the project from a graduate student, spent two evenings reproducing the issue. The fix was one line: trim whitespace before comparing strings. Then write it to the audit log, so any adjustment leaves a trace. That second part is the detail that mattered.

What the patch changed, and what it did not#

OpenTally's tallying logic had always been technically correct under its own tests. The tests fed it clean strings. Real ballots do not arrive clean. A voter types "Smith " and the scanner passes it through. A clerk transcribes a name from a paper backup and hits the space bar twice. Without trimming, the tool counted these as separate candidates and then, depending on the race, either folded them into an "other" column or dropped them.

The patch did not change the total number of votes recorded. It changed whether the system could explain itself afterward. Before the fix, the audit log showed two candidate entries where voters had meant one. After, it showed one entry plus a note: whitespace normalized, 1 record. A canvassing board could read that note and understand exactly what happened.

That difference sounds small. In practice, it meant the difference between a recount that took four hours and one that took four days.

Why one line beat a task force#

Election officials have spent years debating paper trails, risk-limiting audits, and source code escrow. All of those matter. None of them address the mundane fact that data entry is messy. A 2022 survey by a nonprofit election technology group found that write-in handling was the single most common source of post-election discrepancy reports in small jurisdictions, ahead of provisional ballots and machine calibration. The reports were almost never fraud. They were spaces, dashes, and capitalization.

OpenTally's fix addressed the root cause rather than the symptom. It did not add a new feature. It did not require retraining poll workers. It did not trigger a procurement review. It added a trim and a log line, and it made the system honest about what it had done.

The opinion, stated plainly#

Open source election software earns its keep through exactly this kind of change. A proprietary vendor would have logged the bug, triaged it, scheduled it for a minor release six months out, and charged the county for the upgrade. The county clerk who found it might never have learned whether it was fixed. In the OpenTally case, the clerk could read the patch, run the tests, and confirm the behavior on her own test ballots before the next election.

That is the argument for open source in civic infrastructure, and it is not about cost. It is about the distance between the person who finds a problem and the person who can fix it. In a closed system that distance is a contract. In an open system it is a pull request.

The catch that open source advocates skip#

One line of code is cheap to write and expensive to maintain. The trim-and-log patch was merged in April 2023. By the following February, OpenTally had received three related reports: Unicode whitespace, zero-width characters in copied names, and a locale-specific case-folding issue in Turkish. Each required a new conditional, a new test, and a decision about how aggressive normalization should be before it starts changing what voters actually wrote.

That is the real cost. Normalization is a policy choice dressed as a technical one. Trim too little and you miscount. Trim too much and you alter a ballot. The maintainer eventually wrote a short policy document, four paragraphs long, that says exactly which characters get stripped and which get preserved. It is the least glamorous file in the repository and probably the most important.

What other projects should copy#

The lesson is not that every open source project needs a normalization policy. The lesson is that the smallest unit of trust in a civic system is often a comparison operator. When two strings are compared, someone has decided what counts as equal. That decision should be written down, tested, and visible to the people whose votes depend on it.

OpenTally now runs 41 tests on name normalization alone. The original project had none. The county clerk in Colorado still uses the tool. She told the maintainer, in the issue thread, that she now reads the changelog before every election. That is a small habit. It is also the whole point.

More articles