# Knight Capital: Old Code Lost $460M in 45 Min | gen2.dev

> A new feature replaced old code on seven of eight servers. The eighth still had code retired in 2003, and a reused flag woke it up. What the SEC found.

Source: https://gen2.dev/cases/knight-capital/

---

Case file 41

# Knight Capital: one server missed in a deploy, $460 million lost in 45 minutes

On August 1, 2012, new trading code was meant to replace a function Knight had stopped using years earlier. One of eight servers never got the new code, and the old function ran for 45 minutes.

![Slide: eight servers, seven with the new code and one still running the old Power Peg code, and a reused flag that switched the old code on: more than 460 million dollars lost in 45 minutes.](https://gen2.dev/img/case-knight-capital.png)

Most Gen 2 failures take years. This one took 45 minutes. It belongs here because it is the clearest public record of what happens when Gen 1 is never really switched off. Everything below comes from the SEC's order and press release.

## Gen 1: code nobody used

Knight's order router, called SMARS, contained a function named Power Peg. The SEC order records that in 2003 "Knight ceased using the Power Peg functionality." It was not removed: "Despite the lack of use, the Power Peg functionality remained present and callable at the time of the RLP deployment."

Then it was quietly broken. "In 2005, Knight moved the tracking of cumulative shares function in the Power Peg code to an earlier point in the SMARS code sequence. Knight did not retest the Power Peg code after moving the cumulative quantity function." That function was what told Power Peg to stop sending orders once a customer's order was filled.

## Gen 2: new code in the same place

In 2012 Knight wrote code for the NYSE's new Retail Liquidity Program. The order says the new code "was intended to replace unused code in the relevant portion of the order router," and that it "also repurposed a flag that was formerly used to activate the Power Peg code." The plan was that when the flag was set, the new RLP functionality, not Power Peg, would be engaged.

That only works if the old code is gone everywhere.

## The deployment

"Beginning on July 27, 2012, Knight deployed the new RLP code in SMARS in stages." By hand, and once:

-   In the order's words, "one of Knight's technicians did not copy the new code to one of the eight SMARS computer servers."
-   "Knight did not have a second technician review this deployment."
-   "Knight had no written procedures that required such a review."

There was a warning. Before the market opened on August 1, an internal system sent "97 of these e-mail messages to a group of Knight personnel" referring to "Power Peg disabled." They were not designed as alerts, and nobody acted on them.

## August 1, 2012

"The seven servers that received the new code processed these orders correctly. However, orders sent with the repurposed flag to the eighth server triggered the defective Power Peg code still present on that server."

The SEC press release gives the scale: the router "rapidly sent more than 4 million orders into the market when attempting to fill just 212 customer orders," Knight "traded more than 397 million shares," and "eventually suffered a loss of more than $460 million."

The rollback made it worse. The order says Knight "uninstalled the new RLP code from the seven servers where it had been deployed correctly. This action worsened the problem, causing additional incoming parent orders to activate the Power Peg code that was present on those servers." Rolling back to Gen 1 meant rolling back to the broken code.

## What failed

-   **Gen 1 was never removed.** Retired code stayed callable for nine years. This is the [killing Gen 1](https://gen2.dev/guide/killing-gen-1/) step nobody did.
-   **A flag changed meaning.** The same switch turned on the new feature on seven servers and the old one on the eighth. Hodgson's rule on [feature flags](https://gen2.dev/guide/feature-flags-and-dark-launches/) applies: remove them, never repurpose them.
-   **No check that every server got the code.** A [cutover](https://gen2.dev/guide/cutover/) needs proof it reached everywhere, not a person's memory.
-   **The rollback was untested.** Nobody knew that going back meant returning to code that had been broken since 2005.

## What to take from it

-   **Delete retired code.** Unused but callable code is a Gen 1 still running, waiting for a path to it.
-   **Never reuse a flag or a field for a new meaning.** Make a new one.
-   **Automate deployments and verify every target.** Eight servers, eight checks.
-   **Rehearse the rollback.** Know what returning to the old version will actually run.
-   **Treat unexpected messages as alerts until proven otherwise.** 97 emails said something was wrong before the market opened.

## Common questions

### What happened to Knight Capital in 2012?

During a deployment, one of eight servers did not get new code. A flag that the new code reused still switched on an old, retired function on that server, which sent millions of orders in 45 minutes. The SEC says Knight lost more than $460 million.

### What is the lesson for software teams?

Remove retired code instead of leaving it callable, never reuse a flag that once meant something else, and verify that every server got a deployment.

## Sources

1.  [In the Matter of Knight Capital Americas LLC - SEC order, Release No. 34-70694 (October 16, 2013)](https://www.sec.gov/files/litigation/admin/2013/34-70694.pdf) - the Power Peg history, the deployment, the eighth server, the reused flag, the BNET emails and the rollback that made it worse
2.  [SEC Charges Knight Capital With Violations of Market Access Rule - SEC press release 2013-222 (October 16, 2013)](https://www.sec.gov/news/press-release/2013-222) - the order counts, shares, loss and the $12 million settlement
3.  [Release No. 34-67347 - order approving the NYSE Retail Liquidity Program (SEC, July 3, 2012)](https://www.sec.gov/rules/sro/nyse/2012/34-67347.pdf) - the new program Knight's code was written for
4.  [Rule 15c3-5, Risk Management Controls for Brokers or Dealers with Market Access - SEC](https://www.sec.gov/rules/final/2010/34-63241.pdf) - the market access rule Knight was charged under

Last updated November 29, 2026.

## Scorecard

Failed

Gen 1

Power Peg, a function in Knight's order router that it stopped using in 2003 but left on its servers, still callable

Gen 2

New code for the NYSE Retail Liquidity Program, meant to replace Power Peg and to reuse the flag that had once switched it on

Approach

Deploy the new code to eight servers in stages over several days, by hand, with no second person checking

How long

Deployed from July 27, 2012; failed in the first 45 minutes of trading on August 1, 2012

Verdict

It failed: Knight lost more than $460 million in 45 minutes, and the SEC fined it $12 million for the controls that should have stopped it.

## More case files

-   [Netscape 6](https://gen2.dev/cases/netscape-6/)
-   [Python 2 to 3](https://gen2.dev/cases/python-2-to-3/)
-   [Firefox Quantum](https://gen2.dev/cases/firefox-quantum/)
-   [Perl 6 and Raku](https://gen2.dev/cases/perl-6-raku/)
-   [AngularJS to Angular](https://gen2.dev/cases/angularjs-to-angular/)
-   [Windows Longhorn](https://gen2.dev/cases/windows-longhorn/)
-   [Digg v4](https://gen2.dev/cases/digg-v4/)
-   [Twitter to the JVM](https://gen2.dev/cases/twitter-jvm/)
-   [Basecamp](https://gen2.dev/cases/basecamp/)
-   [IPv4 to IPv6](https://gen2.dev/cases/ipv6/)
-   [VB6 to VB.NET](https://gen2.dev/cases/vb6-to-vb-net/)
-   [HTTP/2 and HTTP/3](https://gen2.dev/cases/http-2-and-3/)
-   [K-12 browser rewrite](https://gen2.dev/cases/k12-browser-rewrite/)
-   [Mac OS X](https://gen2.dev/cases/mac-os-x/)
-   [Microsoft Edge](https://gen2.dev/cases/edge-chromium/)
-   [Winamp3](https://gen2.dev/cases/winamp3/)
-   [Slack desktop](https://gen2.dev/cases/slack-desktop/)
-   [Evernote 10](https://gen2.dev/cases/evernote/)
-   [Uber rider app](https://gen2.dev/cases/uber-rider-app/)
-   [HealthCare.gov](https://gen2.dev/cases/healthcare-gov/)
-   [Thunderbird Supernova](https://gen2.dev/cases/thunderbird-supernova/)
-   [Skype](https://gen2.dev/cases/skype-cloud/)
-   [Sonos app (2024)](https://gen2.dev/cases/sonos-app-2024/)
-   [FBI Virtual Case File](https://gen2.dev/cases/fbi-virtual-case-file/)
-   [LinkedIn Inversion](https://gen2.dev/cases/linkedin-project-inversion/)
-   [Netflix to AWS](https://gen2.dev/cases/netflix-cloud-migration/)
-   [TSB migration](https://gen2.dev/cases/tsb-migration/)
-   [Phoenix pay system](https://gen2.dev/cases/phoenix-pay/)
-   [Universal Credit](https://gen2.dev/cases/universal-credit/)
-   [Queensland Health payroll](https://gen2.dev/cases/queensland-health-payroll/)
-   [Facebook for iOS](https://gen2.dev/cases/facebook-native-ios/)
-   [New Microsoft Teams](https://gen2.dev/cases/microsoft-teams-2/)
-   [Dropbox to Python 3](https://gen2.dev/cases/dropbox-python-3/)
-   [Instagram to Python 3](https://gen2.dev/cases/instagram-python-3/)
-   [Discord Go to Rust](https://gen2.dev/cases/discord-go-to-rust/)
-   [Reddit Redesign](https://gen2.dev/cases/reddit-redesign/)
-   [GetPranks](https://gen2.dev/cases/getpranks/)
-   [37signals cloud exit](https://gen2.dev/cases/37signals-cloud-exit/)
-   [IRS Individual Master File](https://gen2.dev/cases/irs-individual-master-file/)
-   [GitHub Rails upgrade](https://gen2.dev/cases/github-rails-upgrade/)
-   [NHS National Programme for IT](https://gen2.dev/cases/nhs-national-programme-for-it/)
-   [Air Force ECSS](https://gen2.dev/cases/air-force-ecss/)
-   [Java SaaS upgrade](https://gen2.dev/cases/java-saas-upgrade/)
-   [ActiveX to WebRTC](https://gen2.dev/cases/activex-to-webrtc/)
-   [All case files](https://gen2.dev/cases/)
