A software bug captured Apple and other huge companies
Tags: testing, watercooler, writing, community
Published: 2022-12-07 14:59:05

We collected some hot stories about programming errors for you to have a little fun and learn something new\. Keep reading to find out how one programmer broke the Internet by deleting a tiny piece of code and see other not\-so\-obvious errors\.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cvef3vkmj1ki6nuw37to.png)

"Error" is something that can scare even experienced developers\. Everyone faces them at some point\. Today you'll see that everyone may screw up, and mistakes shouldn't frustrate you\. We have already published related articles — [Stories about Christmas and New Year Bugs](https://pvs-studio.com/en/blog/posts/0463/?utm_source=website&utm_medium=dev_to&utm_campaign=article&utm_content=1008&utm_term=0463) and others are listed in the end\.

## Who wants to be a millionaire: the Chilean version

This story is about the error that turned the Chilean man's life around\. In May, 2022, a man in Chile was accidentally paid 165 million pesos \(£150,000\), 330 times his salary\. This happened due a payroll blunder error\.

The worker reported about the error to the deputy manager\. The manager asked the worker to go to his bank and initiate the return of the excess money\. You could think the man got back the money, and the story was over\. But it wasn't\.

Well, the man promised his employer to show up in the bank and get the amount refunded\. However, a day later, he was off the radar\. After two days, he appeared and promised to retrieve the amount soon — probably, he was still on the fence :\)\. Diario Financiero reported that, the worker later sent a resignation letter via his attorney, and dropped out of the sight\. 


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r7ccbdtvvclut3jdnw7l.png)

The company he was employed has now reached out to various agencies in attempt to get back the money and registered a complaint of misappropriating funds against the employee\. Let's hope this story keeps going\.

## The £50 million electricity bill

A couple from Lancashire were shocked when their monthly electricity bill had increased from £87 to £53,480,062\. "Unfortunately, I don't have this kind of money in my account\. It was a massive shock," Mr\. Brotherton, a 63\-year\-old accountant, said\.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/209wd3dsmnv9u65hslet.png)

Nigel and Linda Brotherton had a new electricity meter installed, but an electrician didn't connect the wires correctly\. This led to a wrong measure of the electricity usage\. Due to this mistake, their power supplier calculated the bill and sent it to their bank account\. 

"My wife was worried if they had tried to take the money it could have affected our credit rating," Mr\. Brotherton said\. After the recovering from initial shock, the couple contacted the power supplier, who apologized and promised to correct the wires\.

## iPhone's first glitches a month after release

The accident took place a week after iPhone 14 Pro was released\. Some owners have reported that their iPhones cause camera shaking when they use TikTok, Instagram, and Snapchat\.

Multiple users tweeted the videos of how it looked like — opening the camera in certain apps causes it to shake and produce audible grinding sounds\. That's quite a creepy thing\. However, if you use the built\-in camera, nothing is wrong\. 


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/50nmt63oeojdlfv84bqk.png)

Apple reported that the problem was caused by the software issue and not by the third\-party applications\. Apple spokesperson Alex Kirschner stated in his email to The Verge, that the company is "aware of the issue and a fix will be released next week"\. However, Apple didn't explain what exactly had caused the error, and why some users encountered this problem and others did not\. 

Apple introduced a new feature that could actually help you in car accidents — if your iPhone 14 detects a severe car crash, it can help you contact emergency services and notify your emergency contacts\. That's impressive\. But what if an accident takes place on rollercoasters? "You're raving, dude", — you think\. Well, the iPhone 14 is sure it's possible\.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9p3bslpwtua1vcfqxf7f.png)

The car accident detection feature has set off false alarms for emergency personnel near Cincinnati's Kings Island amusement park\. The same crash detection technology is also featured on the Apple Watch 8\. Officials say the fix is simple: Putting the iPhone 14 and the Apple Watch 8 on airplane mode before boarding a rollercoaster\. So, here is the burning question — should we expect signs in the amusement park like "turn off your iPhones before you get on the rollercoaster?"

Let's hope that there are only two glitches in the latest iPhone model and there would be nothing that could dishonor the company's impeccable reputation\.

## How the Windows developer stole 2022 year

On 2021 New Year's Eve, the Windows team decided to wish their Twitter followers a Happy New Year\. The official Windows Developer account tweeted the following:


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5pwi4w2dyc2l8tm5tr0l.png)

That's C\# console code\. If you run this app when it's exactly midnight on New Year's Eve, you'll get a "Happy New Year\!" message\. But if you run it at any other time, it will show you that it's still 2021 — that's how this app should work\. But it didn't deliver the expected result\. 

There is a problem — you can get the New Year greeting at exactly midnight\. I mean you will fail to get the greeting if it is one second into 2022 or one second before 2022\. Moreover, if it's 2022 now, the app will tell you that it's still 2021 — no matter what the date or time is\. It works only for midnight\.\.\.

The Windows developer realized the error and deleted the tweet\. You can watch [Scott Hanselman's overly\-detailed analysis of the many problems with this code](https://youtu.be/Y195oMMLlqM)\. If you're an early\-career developer, you might find this interesting\.

## The "left\-pad" havoc or how a programmer broke the Internet by deleting a tiny piece of code

In March, 2016, Azer Koçulu, a programmer in Oakland, California broke the Internet around the world by deleting 11 lines of code\. Koçulu published his code on [npm](https://www.npmjs.com/about), a popular tool among JavaScript developers that is used to find and install open\-source software\.

Koçulu wrote the project and called it "kik"\. This project was intended to help programmers set up templates for their projects\. By chance, the messaging app created in Ontario, Canada, shares the name with the Koçulu's project\. On March 11, Koçulu received an email from Bob Stratton, a trademark agent of Kik\. Bob Stratton asked Koçulu to change the project's name for legal reasons\. Koçulu rejected his suggestion\. [Here](https://medium.com/@mproberts/a-discussion-about-the-breaking-of-the-internet-3d4d2a83aa4d) you can find the whole discussion \(and find out why two parts failed to reach an agreement\)\. After that, Koçulu intended to take down the packages he had registered on npm\. "I think I have the right of deleting all my stuff from NPM" was the email, that ended up the dialogue between Koçulu and Bob Stratton\.

After a few days, JavaScript programmers around the world started receiving a strange error message when they tried to run their code:

```cpp
Npm ERR! 404 'left-pad' is not in the npm registry.
```

The point is, the code they were trying to run required a package called *left\-pad*, but the npm registry didn't have it\. After that, developers were turned to the GitHub repository, where the left\-pad was supported\. The code that they found looks as follows:

```cpp
module.exports = leftpad;
function leftpad (str, len, ch)  {
str = String(str);
var i = -1;
if (!ch && ch !== 0)
ch = ' ';
len = len - str.length;
while (++i < len)  {
str = ch + str;
}
Return str;
}
```

There are only eleven code lines\. This is a single\-purpose function, simple enough for most developers to write themselves, but lots of npm packages relied on *left\-pad* to do it for them, which is how this tiny bit of code became so important, but unknown\.

Some of the largest, most widely used npm packages platforms have suddenly been broken\. [React](https://reactjs.org/), a JavaScript library for building user interfaces was one of the affected packages\. And many smaller websites such as Quartz's own [Atlas](https://qz.com/434425/atlas-the-new-home-for-charts-and-data/)\. Its absence has been felt around the world — developers from Australia, Germany, the United States, and the Czech Republic commented on the left\-pad page on GitHub\. 

In Ontario, where the problem occurred, Kik's developers had left\-pad problems as well\. Two hours later, they added these 11 lines of code to the npm registry\. This situation proved to be a valuable lesson for developers\. It helped developers understand that wide interests are more important than the wishes of one author\. 

## Conclusion

I hope that this article set you thinking that mistakes are no big deal\. If you are still afraid of programming errors, there are various tools to protect yourself\. For example, our company — PVS\-Studio — develops the static analyzer that can easily detect even ambiguous programming errors\. By the way, we have collected various errors found in open\-source projects as well\. There are Chromium, Linux core, Tizen OS and even Windows Calculator projects listed, you may find it interesting to look at [someone else's mistakes](https://pvs-studio.com/en/blog/inspections/?utm_source=website&utm_medium=dev_to&utm_campaign=article&utm_content=1008&utm_term=inspections) :\)\. 

Let me end up with a phrase from The Simpsons episode, where Lenny says: "Everyone makes mistakes, that's why pencils have erasers"\.

PS: didn't the errors seem funny enough to you? Then here is a collection of hilarious memes about software errors that people have encountered in their daily lives:

1\. How?


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dhwfrh2ql9lspyqolhad.png)

2\. What the hell did I do


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t4bmj948ywzbmu0tuedz.png)

3\. Well, great\.\.\.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x5o5tvv5o49ebg0z92uh.png)

4\. Scuber Diver


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1d20ldof0lv2nbcbsaxt.png)

5\. This is getting ridiculous


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1h3mnbxdildei2hcau1r.png)

6\. I don't really know what to say


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jr1ik9evi3v4ksqh5d23.png)

7\. Homonyms are such a bliss to a Virtual Assistant


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mp86yhumfkffgn4qf20i.png)

8\. Oh no, my PC ran away


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/a4nbrq838tezzmfwcq5k.png)



The pictures were originally published on boredpanda\.com\.

## Additional links

1. [Toyota: 81 514 issues in the code](https://pvs-studio.com/en/blog/posts/0439/?utm_source=website&utm_medium=dev_to&utm_campaign=article&utm_content=1008&utm_term=0439)
1. [Killer Bug\. Therac\-25: Quick\-and\-Dirty](https://pvs-studio.com/en/blog/posts/0438/?utm_source=website&utm_medium=dev_to&utm_campaign=article&utm_content=1008&utm_term=0438)
1. [Stories about Christmas and New Year Bugs](https://pvs-studio.com/en/blog/posts/0463/?utm_source=website&utm_medium=dev_to&utm_campaign=article&utm_content=1008&utm_term=0463)
1. [The First Bug on Mars](https://pvs-studio.com/en/blog/posts/0462/?utm_source=website&utm_medium=dev_to&utm_campaign=article&utm_content=1008&utm_term=0462)
1. [A space error: 370\.000\.000 $ for an integer overflow](https://pvs-studio.com/en/blog/posts/cpp/0426/?utm_source=website&utm_medium=dev_to&utm_campaign=article&utm_content=1008&utm_term=0426)
1. [Bugs from the USSR](https://pvs-studio.com/en/blog/posts/0479/?utm_source=website&utm_medium=dev_to&utm_campaign=article&utm_content=1008&utm_term=0479)