Knight Capital's $460 Million Deploy
One of eight servers missed a deploy. Old code woke up and traded 397 million shares in 45 minutes.
- Severity
- Front-page news
- Difficulty
- beginner
- Companies
- Knight Capital
- Tech
- Algorithmic trading, Deployment, Feature flags
- Root cause
- operator mistake, latent bug
The story
Quick (1 min)
On 1 August 2012, the US trading firm Knight Capital lost more than $460 million in about 45 minutes. That was enough to push the company into a rescue deal within days.
Knight was rolling out new trading code to eight servers. A technician copied it to only seven. The eighth still had old, long-retired code called "Power Peg".
The new code reused an old on/off switch (a flag) that used to turn on Power Peg. When trading started, orders carrying that flag reached the eighth server and woke up the old code. Power Peg had been broken years earlier and no longer knew when to stop, so it kept sending orders into the market.
The lesson: delete dead code, don't reuse old flags, and make deploys automatic and checked.
Keep reading to the end to earn XP.Read. XP earned.
Engineer (2 min)
The system. SMARS was Knight's automated order router. It took "parent" orders and split them into smaller "child" orders sent to exchanges.
The change. For the NYSE's new Retail Liquidity Program (RLP), Knight wrote new SMARS code meant to replace Power Peg, functionality unused since 2003. Crucially, the new code repurposed the flag that used to activate Power Peg.
The latent bug. In 2005 Knight moved Power Peg's "cumulative quantity" tracking earlier in the code, the part that tells it when a parent order is filled. Knight never retested Power Peg afterwards, so if it ever ran again it wouldn't know when to stop.
The deploy. From 27 July, Knight deployed RLP code in stages across eight servers. One technician didn't copy the code to the eighth server. No second technician reviewed it, and there were no written deployment procedures.
Market open, 1 August. Seven servers handled RLP orders correctly. On the eighth, the flag triggered Power Peg, which sent child orders continuously for each of 212 parent orders. The result was 4 million executions in 154 stocks, more than 397 million shares in about 45 minutes.
Making it worse. While firefighting, Knight uninstalled the new code from the seven good servers. Now those servers ran Power Peg too, and the problem got worse.
Warnings ignored. From 8:01 a.m., 97 automated "Power Peg disabled" emails went to staff before the 9:30 open. They weren't designed as alerts and weren't read.
Interview takeaway: this is the classic argument for automated, verified deploys, deleting dead code, and kill switches.
Keep reading to the end to earn XP.Read. XP earned.
Deep dive (2 min)
Timeline (from the SEC order, 16 October 2013)
- 2003: Knight stops using Power Peg, but the code remains "present and callable."
- 2005: the cumulative-quantity function is moved earlier in the SMARS sequence. Power Peg is not retested.
- 27 July 2012 onward: RLP code is deployed in stages to SMARS servers on successive days. One of eight servers never receives it. No one notices.
- 1 Aug, ~8:01 a.m. ET: pre-market RLP orders hit the stale server's logic, and internal "BNET reject" emails start: "Power Peg disabled." 97 are sent before the open.
- 9:30 a.m.: market opens. RLP orders with the repurposed flag reach the eighth server and Power Peg sends child orders "continuously... in rapid sequence."
- Next ~45 minutes: staff try to find the source in live trading. Uninstalling the new code from the seven healthy servers spreads the problem.
- End state: about $3.5 billion net long in 80 stocks and about $3.15 billion net short in 74 stocks. Knight "realized a $460 million loss."
Market impact
For 75 stocks, Knight's executions were more than 20% of trading volume and contributed to price moves above 5%. For 37 of those, prices moved more than 10% while Knight made up more than 50% of volume.
Control failures the SEC cited
- No written code development and deployment procedures for SMARS, and no second-technician review.
- No protocol for testing unused code on production servers.
- No controls comparing orders leaving SMARS against orders entering it.
- No procedures to halt SMARS in response to its own errors, and no supervisory incident-response procedures.
- Automated messages that weren't designed as alerts, so a real-time warning went unread.
Consequences
The SEC charged Knight under the Market Access Rule (Rule 15c3-5), and Knight agreed to pay a $12 million penalty. Wikipedia notes that Knight raised about $400 million from investors led by Jefferies on 5 August 2012 to stay in business, and its stock fell more than 70%.
"Knight did not have a second technician review this deployment and no one at Knight realized that the Power Peg code had not been removed from the eighth server, nor the new RLP code added." (SEC)
Keep reading to the end to earn XP.Read. XP earned.
Failure replay
Step by step, what broke and what it hit next. Showing the key steps. Switch to Engineer or Deep dive for every step.
- 2003–2005Power Peg codedegraded
Power Peg is retired but left in place. A 2005 refactor breaks its "order filled" tracking, and it's never retested.
Affects: Server 8
- Jul 27, 2012Deploy processfailing
New RLP code reuses Power Peg's flag. A manual staged deploy copies it to seven of eight servers.
Affects: Servers 1–7, Server 8
- Aug 1, 8:01 a.m.Server 8degraded
Pre-market orders trigger 97 "Power Peg disabled" emails. Nobody treats them as alerts.
- 9:30 a.m.Server 8compromised
Market opens. Orders with the reused flag wake up Power Peg on the stale server.
Affects: Stock exchanges
- 9:30+Stock exchangesfailing
Power Peg never learns its orders are filled and sends child orders endlessly for 212 parent orders.
- During responseServers 1–7compromised
Trying to fix it, staff uninstall the new code from the healthy servers. Now they run Power Peg too.
Affects: Stock exchanges
- ~45 minStock exchangesdown
4 million executions, 397 million shares, and multi-billion-dollar positions Knight never intended to take.
Affects: Knight Capital
- AfterKnight Capitaldown
Knight realises a $460 million loss and needs outside investors to stay in business.
Impact
- Who was affected
- Knight Capital, plus other market participants trading in 154 affected stocks at distorted prices.
- How long
- About 45 minutes of erroneous trading.
- Cost
- Over $460 million in trading losses (SEC); $12 million SEC penalty.
Lessons
- Automate deploys and verify every target got the same version. Manual copying with no review fails silently.
- Delete dead code instead of leaving it callable, and never reuse old flags with new meanings.
- Build kill switches and output-vs-input sanity checks into systems that act autonomously.
- Have an incident-response plan; under pressure, Knight's rollback made things worse.
- Automated messages that matter must be real alerts with owners.
Quiz
What went wrong with the deployment?
The answer is A technician didn't copy the new code to one of eight servers. Seven servers got the new RLP code. The eighth still had the old Power Peg code, and no second technician reviewed the deploy.
Check answer
A technician didn't copy the new code to one of eight servers. Seven servers got the new RLP code. The eighth still had the old Power Peg code, and no second technician reviewed the deploy.
Why did the old Power Peg code activate?
The answer is The new code reused the flag that used to turn Power Peg on. The new RLP code repurposed Power Peg's flag. On the stale server, that flag still meant "run Power Peg".
Check answer
The new code reused the flag that used to turn Power Peg on. The new RLP code repurposed Power Peg's flag. On the stale server, that flag still meant "run Power Peg".
What action during the response made the problem worse?
The answer is Uninstalling the new code from the seven healthy servers. Removing the new code left the reused flag pointing at Power Peg on those servers too, spreading the faulty behaviour.
Check answer
Uninstalling the new code from the seven healthy servers. Removing the new code left the reused flag pointing at Power Peg on those servers too, spreading the faulty behaviour.
How many automated warning emails were sent before the market opened?
The answer is 97. Knight's system sent 97 "Power Peg disabled" emails before 9:30 a.m. They weren't designed or treated as alerts.
Check answer
97. Knight's system sent 97 "Power Peg disabled" emails before 9:30 a.m. They weren't designed or treated as alerts.
Interview prep
Try answering out loud before you open the model answer.
- system design
Design a deployment process for a fleet of servers where a partially applied deploy could be catastrophic, as at Knight Capital.
Show model answer
Make the deploy declarative and automated: build one artifact, push it to every target with a tool, and verify each host reports the expected version before enabling new behaviour. Gate the new behaviour behind a fresh feature flag, not a reused one, and only turn it on after the fleet is confirmed consistent. Canary first with small limits. Add runtime safety: per-host checks that refuse to start if the version doesn't match, plus circuit breakers on business metrics (order volume vs input). Rollback should be a rehearsed, single action that restores a known-good state.
A strong answer hits:
- Automated deploys with version verification on every host
- New feature flags, never repurposed ones
- Enable features only after fleet consistency is confirmed
- Business-level circuit breakers and kill switches
How did your answer compare? - debugging
Mid-incident, you roll back a change and the problem gets worse. What might be happening, and how would you reason about it?
Show model answer
The rollback isn't returning to a known-good state, or the system is in a mixed state you don't understand. At Knight, removing the new code from seven servers left the old flag still being sent, which activated Power Peg everywhere. Before acting, ask what the "old" state really looks like given the current inputs. Prefer the smallest action that stops harm, such as a kill switch, halting the system or stopping traffic, over code changes made while live. Compare the hosts that work against the ones that don't.
A strong answer hits:
- Rollback must target a known-good state compatible with current inputs
- Mixed-version fleets cause surprising behaviour
- Stop the bleeding with a kill switch before changing code
- Diff healthy vs unhealthy hosts
How did your answer compare? - behavioural
You notice a stream of odd automated emails before a big launch. What do you do?
Show model answer
Treat unexplained signals before a launch as possible warnings. Knight received 97 "Power Peg disabled" emails before market open and nobody acted on them. I'd quickly find the owner and ask what the message means; if it involves the launch path, escalate and consider delaying. Afterwards, I'd push to turn meaningful messages into real alerts with owners, or remove them, because noise trains people to ignore everything.
A strong answer hits:
- Investigate unexplained signals near a launch
- Escalate early; delaying is cheaper than a failure
- Fix alerting hygiene afterwards
How did your answer compare?
Go deeper
- Official reportIn the Matter of Knight Capital Americas LLC (SEC Order, Release No. 70694)U.S. Securities and Exchange Commission, link checked 2026-11-24
- ArticleSEC Charges Knight Capital With Violations of Market Access RuleU.S. Securities and Exchange Commission, link checked 2026-11-24
- ArticleKnight Capital Group — 2012 stock trading disruptionWikipedia, link checked 2026-11-24