this post was submitted on 19 Nov 2026
196 points (99.5% liked)

Programmer Humor

34233 readers
1201 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 3 years ago
MODERATORS
 

A while back I was developing a workflow scheduler. However the run duration kept coming back negative. The runs kept finishing like 15 seconds before they started. Eventually I figured out why; the company had configured a policy to use their custom NTP server, but it was 16.7 seconds off. So my Windows laptop's time was in the future, but the WSL VM (which ran the program) used another NTP server and was correct. In the end I just added a bodge that made the program request the time from an external server on startup to calculate an offset.

top 50 comments
sorted by: hot top controversial new old

Probably the silliest thing was discovering the hard way that x.5 doesn't always round up in Python's round(). Python uses "round to even" so that 1.5 rounds to 2 and 2.5 also rounds to 2.

[–] SomeRandomNoob@discuss.tchncs.de 4 points 16 hours ago (1 children)

I lost so many braincells debugging silly shit, that i can't remember anything about it.

[–] definitemaybe@lemmy.ca 2 points 14 hours ago

ikr? I was racking my brain for a silly one, because I know I spent hours debugging something ridiculous lately. I think earlier this week? A rookie bug of my own doing, like using the wrong data source in the first step? Or maybe it was a 0 vs. 1 index error? Or was it forgetting to hit save on one of the config files, then wondering why the change wasn't propagating?

So, so many stupid, basic errors. They all blur together.

[–] Bassman1805@lemmy.world 4 points 16 hours ago (1 children)

I had a system that would fail if you ran it on leap days.

It was used to calibrate equipment, and would generate a calibration certificate after the procedure was completed. One field in the certificate was "calibration due date", which the program calculated by taking the current date and adding 1 to the year.

Whoever wrote the program had enough foresight to use a datetime library that recognized "Feb 29, 2021" was not a valid date, but not enough foresight to use that library's date math functions to add 365 days.

The official solution was "just hold off on calibrations until tomorrow and we'll fix that in the 2.0 calibration machine we're working on." The 2.0 machine was already years behind schedule, and I'm not sure it ever got completed after I left that company. I bet the bug still existed on Feb 29, 2024.

[–] Bassman1805@lemmy.world 4 points 16 hours ago

On a related note: Falsehoods programmers belive about time

https://gist.github.com/timvisee/fcda9bbdff88d45cc9061606b4b923ca

[–] r0bi@infosec.pub 3 points 16 hours ago

A [shutter] Coldfusion web application regularly polled an industrial temperature probe for walk-in refrigeration/freezers in warehouses around the world over HTTP. Following an upgrade (CF9 to 10 I think) the temperature calls stopped working.

Using Wireshark I discovered the probes we're not sending 200 OK, just raw HTML the moment you connected to the port.

I wrote a quick workaround wrapper in python that turned into a permanent solution until those probes we're replaced.

[–] the16bitgamer@programming.dev 3 points 18 hours ago

Back in the unit 5 days, I remember a weird touch bug on my input controller. Only my wife was able to trigger it and after some testing, it turned out unity wasn’t pulling the screen fast enough to register when her finger left the screen and when it touched it again. I made a fix for it and kept it in since.

[–] thebardingreen@lemmy.starlightkel.xyz 12 points 1 day ago* (last edited 1 day ago) (1 children)

I've told this story before but we were supporting a custom ATS for a customer where we had this perfect storm happen.

  1. We had a bug in it that we sorted out eventually, where sometimes when you fed it input that contained weird characters, it would cause the name of a function or variable to get echoed in the nearby output. So if you had a variable called $debug_page or a function called $send_to_processing, and you input say some Arabic characters (this customer had many job applicants who were native Arabic speakers) you might get output that was the output you wanted + that string so

Searching... 10 applicants found debug_page or Applicant: Mohammad Al-Saud send_to_processing.

  1. We had this developer who named things in lolcat speak. So a function might be called $ICanHaz($applicant) or $LongStringIsLong($string).

So we got an email from the customer saying they had a VERY offended job applicant and what had happened. They had clicked the reject button on someone, which triggered the system to send an automatic rejection form letter to the applicant. This applicant had some Arabic character in their last name, which triggered the bug.

And the reject applicant function had been written by this guy. So that poor applicant got an email that said

Dear Applicant

We have reviewed your application and while we thought you have an excellent background unfortunately we decided you are not a good fit for our company at this time... blah blah blah etc...

YouCanHazNoJobKThanksBai

[–] veni_vedi_veni@lemmy.world 7 points 1 day ago (1 children)

I can't imagine anyone over the age of 25 using lolcat naming conventions

He wasn't over 25.

[–] thatOneGuy@aussie.zone 7 points 1 day ago

Not a month goes by that I don’t regret introducing my wider analytics team to RegEx.

[–] ReginaPhalange@lemmy.world 11 points 1 day ago (1 children)

It wasn't dirt on my monitor, it was a weird unicode character

[–] ThirdConsul@lemmy.zip 6 points 1 day ago (1 children)
[–] nightlily@leminal.space 3 points 14 hours ago

Happens a lot in my line of work due to artists copy and pasting what they shouldn’t. Always fun how the related bugs manifest.

[–] opensesame_365@lemmy.zip 6 points 1 day ago (1 children)

I spent a disturbing amount of time figuring out why I didn't get a video output.

I had not configured DP on the monitor.

[–] definitemaybe@lemmy.ca 2 points 14 hours ago

I just turned everything off and on again trying to figure out why a display wasn't working yesterday. It was on the wrong input selection.

I was the one who swapped the input source.

[–] skisnow@lemmy.ca 15 points 1 day ago

3rd line support for a global IT brand you have heard of, on the kind of security product that people don't like to mess with too much once it's installed on their servers.

Bug had been in the tracker over 3 years when I joined, and had defeated anyone who tried it. Segfault that happened to only one customer, unpredictably, and only once or twice a year, and nobody could reproduce it.

After a few weeks of tracing the compiled code line-by-line I found a race condition in the teardown of an object. That's not the silly part.

I wrote the patch for the version of the code the customer was running and was hailed as a mighty hero and everyone on the bus clapped etc. Then I went to forward-port the patch to the newer versions of the program and... it was already fixed there. Some fucken doofus had either fixed the bug without realizing, or, fixed it and just skipped the standard backporting process that would normally patch all the other versions that were still in support.

[–] Agent641@lemmy.world 25 points 1 day ago (3 children)

Forgot to save. You ever spend 45 minutes looking for a bug you already fixed?

[–] CookieOfFortune@lemmy.world 3 points 19 hours ago

Back in the day not saving means you might lose your work during a crash. So ctrl-s after every change became habit even years into auto saving editors.

[–] Buddahriffic@lemmy.world 5 points 1 day ago

Or variations of this caused by a makefile not having correct dependencies set up, eg it points to dependent source files but not the headers so header updates get ignored during compiles. Made me add a "make clean" step to the debug process of "change that should have fixed the issue appears to be doing nothing at all" issues, or even just defaulting to rebuilding everything because test times can take hours or even days to get to the issue, so I don't want to waste that much time only to find out it's still running the old version.

[–] bss03@infosec.pub 4 points 1 day ago

Yep. Last time I used MS Visual Studio it was still all too eager to run an older binary, and I lot plenty of time debugging a binary that doesn't reflect the current code. And, even more recently, when testing requires you to remember to run separate routines to upload to a testing server and restart a service, it is really easy to forget to do that when you are bouncing between the code and the browser console to figure out what to change.

[–] kopasz7@sh.itjust.works 27 points 1 day ago* (last edited 1 day ago) (1 children)

ECU (the computer in your car) only came online on the bus at every 3rd restart. No memory was written, yet the bastard somehow knew it anyway.

Turns out the transciever's enable pin was left unconfigured and supposedly some charge accumulated during two startups to set it.

load more comments (1 replies)
[–] ExtraMedicated@lemmy.world 70 points 2 days ago (3 children)

Internet Explorer didn't automatically have "console.log" defined until you opened the console window. So there was an error breaking the web page that would disappear when you tried to open the console to see the error. The error was that console.log wasn't defined. Fucking IE.

[–] OldMrFish@feddit.dk 3 points 13 hours ago

Saw this way too many times. Eventually the first thing to check whenever a customer was having weird issues would be to check, if someone had accidentally left debugging comments in prod code..

[–] 87Six@lemmy.zip 11 points 1 day ago

That would genuinely make me clock the fuck out for the day when I figured it out, jesus christ.

load more comments (1 replies)
[–] nanometer1625@thelemmy.club 17 points 1 day ago* (last edited 1 day ago) (1 children)

One time I was struggling to understand why a code branch I wrote was being unexpectedly taken, and I found that I had written something like if pet == 'cat' || 'dog'. Since 'dog' was a string, the condition was always true. I laughed out loud at myself.

[–] bss03@infosec.pub 3 points 1 day ago

A static type system can be used to make this type of error occur at compile-time rather than runtime. But, not everyone wants to make that tradeoff and some even like the semantics applied to that kind of expression. || often gets tasked with handling null/undefined in JS, e.g.

[–] exdor@programming.dev 6 points 1 day ago

My system didnt boot for obscure reasons

Found out something had caused my nix store (packages) to explode in size. Chrooting didnt work as it was filled to the last byte. Deleted some files, then chrooted in and did a cleanup

[–] shalafi@lemmy.world 24 points 1 day ago (2 children)

This was dumb, and it was on me.

Couldn't figure out why two obscure software packages were erroring in a very particular way. Thinking there was no way in hell a search would help, I plugged it in Google. There was user on Spiceworks outlining my exact situation and fix. Who is this mad genius?!

It was me. I fixed it two years previously and went back to note so in the forum.

[–] Buddahriffic@lemmy.world 9 points 1 day ago

Would have been even more hilarious if your previous fix was hidden by a "nm, I figured it out" update.

load more comments (1 replies)
[–] MECHASQrL@lemmy.world 28 points 2 days ago (2 children)

I can't quite remember what I was debugging exactly, some constant was different in runtime compared to what was in code. Someone added a leading 0 to a const int to make the number align with others in terms of character count just to make it pretty I guess. That is when I learned about octal literals in C. I think that was the only time I've seen one in many years and it was used unintentionally. To save you a search leading 0 in C makes number to be base 8 same as 0x makes it hex aka base 16, so that inconspicuous 01000 is not a 1000 it's a 512.

It's one of the most sneaky legacy foot-guns C (and C-like languages) have. I think we're decades removed from using octal everywhere, except for Linux filesystem flags (which the letter-equivalents should probably be used instead).

load more comments (1 replies)
[–] lime@feddit.nu 116 points 2 days ago (6 children)

i was just a user, but i debugged a weird issue where one of those blue light reduction programs would start flickering and inverting day and night time during june.

turns out the dev had made the assumption that the sun always rises before it sets, and i was far enough north that the sun would start setting after midnight.

load more comments (6 replies)
[–] Thebeardedsinglemalt@lemmy.world 19 points 1 day ago (3 children)

I fixed a 5 year old issue that the previous guy claimed was "unfixable". Turns out it was because someone copy-pasted a value from an Outlook email..and it had a single dash in it...which outlook converted to a double dash.

load more comments (3 replies)
[–] jason@discuss.online 6 points 1 day ago* (last edited 1 day ago)

Back when I was learning c++ on Windows, I naively jumped right into game dev (as one does) before understanding the purpose of a debugger. I spent 3 months chasing down a period that should have been a comma. Due to function overloading, this was not an error or warning. It's just silently calling the wrong function and crashing the program.

Thus began my distrust of magic compiler features. To save typing a handful of characters, languages add new ways to blow off your own leg. Every time you blow off your leg, the time you lose is orders of magnitude greater than just being explicit. Just read this thread for more examples. Today, I program almost exclusively in C. I have no desire to use more feature-rich/higher level languages for anything.

[–] expletivedeleted@lemmy.zip 27 points 2 days ago (12 children)

I was hired to work on a CMS designed for schools. I was tasked with debugging.

I started off with the newest issues and worked my way back.

Well, there was a bug where teachers would upload a video but it wouldn't play on the page. It was plaguing a team of 8 for YEARS.

It was mentioned in our morning standup, and I decided to fast track it.

The dude who wrote the code was shrinking the display size in half: well how do you think that would work when a dimension of the video isn't divisible by 2?

So, remember, I am the new guy, quickly fixed it using an if/then and the % modulus operator, and lo and behold, the next morning standup I had to explain the fix in front of the project manager, his boss, and the entire team...

fucking awkward. "You see, there's this thing in division called a remainder." This was the first thing in the morning.

But because the bug had been so ever present, that's why the boss's boss attended the standup. God, I just wanted to die.

[–] Buddahriffic@lemmy.world 5 points 1 day ago (2 children)

Ok, I understand the issue but I don't understand your embarrassment from it. You didn't write the initial bug.

Btw, a faster way to check if a value is even is to just do a bitwise AND on bit 0 (if it is an integer, though it needs to be an integer for modulus to work anyways).

In many languages it looks like:

if ( val & 1 ) { \ it is odd }

Division is a multi-cycle operation but bitwise comparisons are simple enough to be done in a single cycle, or could even be thrown on to instructions as a free extra that doesn't add any extra cycles (eg any instruction with a bit mask, though it depends on the implementation as to whether it's done for 0 extra cycles or more).

Doesn't really matter for a one off operation like halving the value of video display parameters, but if you have a loop that needs to check a lot of them, the bitwise and will pull ahead.

And if you're thinking "well we need to divide by 2 anyways and the modulus is available from that operation as long as the compiler sees it should save the result and the modulus", a bitwise shift right (non-circular) of 1 is also way faster than divide by 2.

Both of these can also be generalized for any power of 2, if necessary.

[–] pipe01@programming.dev 2 points 10 hours ago

Most compilers worth their salt will optimize a modulo evenness check to a bit operation anyways

[–] expletivedeleted@lemmy.zip 1 points 18 hours ago

Dude, the embarrassment was because I was the new kid.

It was pointed out. It was a bug that had plagued the company. Thought this was all explained.

load more comments (11 replies)
[–] librekitty@lemmy.today 43 points 2 days ago (6 children)

two days for an = instead of an ==

load more comments (6 replies)
[–] Simulation6@sopuli.xyz 19 points 2 days ago (1 children)

Person before flipped a bunch of if checks to put the value before the variable (if 6==x rather then if x==6). They messed up a bunch of the <= and >= checks by forgetting to reverse them. I improved performance and fixed numerous bugs by tracking those down.

[–] Feathercrown@lemmy.world 15 points 1 day ago* (last edited 1 day ago) (1 children)

Ah yes, yoda conditionals. Because guarding against accidentally typoing if(x=6) is worth destroying your code's readability.

[–] kunaltyagi@programming.dev 9 points 1 day ago* (last edited 1 day ago) (2 children)

This is not needed anymore thanks to compiler warnings

load more comments (2 replies)
load more comments
view more: next ›