DEV Community

Peter Tasker
Peter Tasker

Posted on

What's the dumbest bug you caused yourself

I was thinking about this recently, what's the dumbest bug you've caused yourself?

I'll go first.

More often then not my code won't work because of a rampant letter 's' somewhere in the code. 'Undefined variable s' etc.

The reason? Hitting CMD-s to save a file and letting off CMD too early...

:face-palm:

Top comments (48)

Collapse
 
ardennl profile image
Arden de Raaij

Editing in development environment while watching another environment for changes that never come. I'm afraid to say I've wasted way too much time wondering why nothing worked.

Collapse
 
hrmny profile image
Leah

Yeah happened to me a lot, or copying a file and then editing the original expecting the copy to change

Collapse
 
sir_wernich profile image
Wernich ️

oh man, similar thing. we have a project that loads two other projects as modules. the one module uses hardlinks so you're able to change the JS/cshtml while it's running. the other project was never set up that way (probably because it was going to be a temporary project). the projects are combined in VS with a "combined" project that has everything in one place so we don't need to run three instances of VS.

so instead of stopping, changing and rebuilding, i would just edit the js/cshtml files that were copied to the main project when everything builds, then copying the changed files back to the project's source directories...

... except when i didn't copy and thought it was safe to rebuild. lost my work so many times. facepalm

Collapse
 
abandonedfridge profile image
Daniel Nielson

How about freaking out over why changes aren't posting to dev only to realize you've been pushing to production... Yeah, me neither...🤫🙄

Collapse
 
ptasker profile image
Peter Tasker

Oh man, so much this.

Collapse
 
kammy_smb profile image
kammy

This has happened so many times to me it's quite embarrassing at this point

Collapse
 
kayis profile image
K • Edited

Classic. Wrong file/folder/server is the first I look when helping a co-worker debugging.

Next: permissions

Also: Caching

(Still happens to me all the time xD)

Collapse
 
ardennl profile image
Arden de Raaij

I like how many people relate. Makes me feel slightly less idiotic 😂

Collapse
 
sabatesduran profile image
Dídac

So many times

Collapse
 
gregorgonzalez profile image
Gregor Gonzalez

This is really common. Happened to me when I work on multiple projects at same time. Also when I have many copies "app" "app1" "app2" "apptest"

Collapse
 
andy profile image
Andy Zhao (he/him)

I dropped test coverage by over 60%, all because I left a setting that focused on running a single test and only that test.

This happened today.

Collapse
 
ben profile image
Ben Halpern

One time I was writing some code and I heard the Mac trash can sound in my headphones and it confused me for a second, but I kind of shrugged it off. A little later I went to commit some code to production and it was a tiny fix and I did git add . and made the push without thinking much. Then I went off to do some other things.

A little later I notice that A CRITICAL IMAGE IS MISSING and that's when I realized what the trash can sound was. I accidentally sent something to the trash as my computer lagged and I clicked some keys while it was frozen.

I HEARD THE TRASH CAN sound and when I put two and two together it was major face palm.

Very sloppy.

Collapse
 
ptasker profile image
Peter Tasker

Lol, yeah the trash can sound is never good...

Collapse
 
frosnerd profile image
Frank Rosner

Neither is git add . :P

Collapse
 
garwan50 profile image
Garwan50 • Edited

Not a big deal but i wrote
curl_setopt($handle, CURLOPT_HTTPHEADER, "Authorization : something");
instead of
curl_setopt($handle, CURLOPT_HTTPHEADER, "Authorization: something");
took me three days and stackoverflow to notice it

Collapse
 
falansari profile image
Ash

ouch XD

Collapse
 
jballanc profile image
Joshua Ballanco

The biggest face-palm bug I've faced was while working on a language runtime. I was implementing a method aliasing feature that, if working correctly, would extract a method from one object and inject it into another. I coded up a solution that should have worked, fired up a REPL, and attempted to hit the new aliased method.

I was promptly greeted by an error with the message "This method does not exist." Crud!

I went back and reviewed my implementation. I tried adjusting some things, moving allocations and dereferencing pointers slightly differently, and yet each time I got the same answer: "This method does not exist." I put in some debug logging statements, but everything looked correct. I stepped through the whole process in a debugger, and still everything looked correct.

At a loss, I randomly decided to look at the implementation of the method I was attempting to alias. Since it was a library method, and not part of the project I was working on, I had to go check out the code and dig in. Eventually, after working out all the complex inheritance and class-cluster implementation details, I found the source of the specific method I was working with. It was, in effect:

fprintf(stderr, "This method does not exist.");
Collapse
 
alephnaught2tog profile image
Max Cerrina • Edited

I just laughed so hard I woke the dog up.

My project for PHP this past semester was a site to track my errors with the idea that eventually you could have multiple users, share them, think of things to look for in your own code, learn, etc. I hadn't thought about the debugging issues that would arise when my code and text was full of the word "error" and oh man, the number of times I would stare at the screen because of the error message that showed up... only to realize that no, that WAS what was supposed to happen, I was TRYING to show those error messages.

Eventually I just added a temporary class to make all of those "error" messages bright green.

Collapse
 
klemensek profile image
klemensek

my cheapest bug in the code:
back in 2005 I needed to send email to 300 customers in two for loops..
so I sent 300 identical emails to each customer, because of index error in second for

Collapse
 
davidaddario profile image
David Addario

This one time, in band-camp, my login authentication banned the IP address of a user who had 3 consecutive failed login attempts. Out of nowhere, the entire e-commerce site was "down". Needless to say, It took me an entire day to figure out that one of the managers had forgotten his password and banned the outbound IP address for the entire organization. Ugh

Collapse
 
erinlmoore profile image
Erin Moore

I accidentally mis-wrote some CSS, so the animation from an svg loading element bled over to all the svg's on the page. The feature we were working on involved a rating page with a bunch of yellow stars (think amazon reviews) that now all spun around. It delighted everyone and they made me show it to the executive in charge of the whole division.😅

Collapse
 
hewerlin profile image
Hendrik Ewerlin

I developed a company-internal social application with LDAP authentication.
I used a code snipplet.
As it turned out, any username with empty password worked just fine. The code snipplet would simply skip password check for "undefined" empty password.
:-o

Collapse
 
falansari profile image
Ash

I nearly made that same mistake last month x'D luckily while I was testing login, I "accidentally" left the p.w field empty when I was trying out different combos. Lo and behold I got in lol! Fixed fast.

Collapse
 
sir_wernich profile image
Wernich ️

it took me an hour to figure out why i only sometimes got a certain thing to happen (i can't remember what it was, so let's call it a popup). i'd go through the process of doing what needs to be done and only sometimes the popup worked and i couldn't figure it out.

turns out i shot myself in the foot when i used

if (variable) {
...
}

"that won't work you knob! 0 is a valid value!"

Collapse
 
codemouse92 profile image
Jason C. McDonald • Edited

Spent two days debugging a seemingly impossible freeze-crash.

Day two, my non-programmer mother said "I bet you forgot a semicolon somewhere."

Ten minutes of desk-checking later, yup, there it was. Missing semicolon in a for loop, making it infinite.

Collapse
 
bgadrian profile image
Adrian B.G. • Edited

Every big bug/issue I wrote changed the way I think&code, to avoid them in the future, examples:

  • I don't use negation operator, I'm always explicit if (a == false)
  • I use verbose variables after I've spent many hours on a bug like:
//big event loop, within a huge 2D grid game system
//..lots of code
for (x=0; ..; x++) {
    for(y=0;...;y++{
       //lots of code

       //search for a neighbour
       for(x=...;x..){
        }

    }
}//spend many hours to find out why the map was not rendered correctly

I don't remember the specifics, I think it was a shadowing and not declaring var mix of issue, nevertheless now I will try explicitly to avoid i,j,x,y in loops, and ofc I use linters in big projects and static typed languages :))

Collapse
 
djpallotta profile image
D. J. Pallotta

Forgot to set up a rewind for a segue and wondered why the app dutifully consumed memory no matter how many times the "back" button was tapped. That screen is gone, why are there a dozen copies in memory??!!?

After that adventure I forced myself to learn how to properly use navigation controllers.

Collapse
 
cabe_bedlam profile image
Gregg Bond • Edited

Integrating some network code for broadcast traffic, the receiver binds to any active network connections (this is important).

I am receiving every packet twice, without fail.

I go up and down through my transmission code, even adding in timestamp payload to ensure its unique. Check the receive, sure enough, it's decoding the same packet twice, as it appends different timestamps to the decoded payload. So I dive into the code that end.

Turns out I had left the wifi on my laptop, which is also connected to the same network as the hardline.

Whole afternoon pissed up the wall. FMAL.

Collapse
 
antonfrattaroli profile image
Anton Frattaroli

Boolean errors. Always forgetting to add a ! in validation code.