this post was submitted on 02 Oct 2023
1099 points (98.8% liked)

Programmer Humor

32479 readers
617 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS
 
all 50 comments
sorted by: hot top controversial new old
[–] norgur@discuss.tchncs.de 152 points 1 year ago (5 children)

Instant PTSD. Only beaten by an error in, say, Line 84 in a file that has 72 lines only

[–] dinckelman@lemmy.world 72 points 1 year ago (2 children)

Debugging Typescript without proper tools, in a nutshell. The original file might have 72 lines, but the transpiled JS file it's debugging is like 3 times that many

[–] GamesRevolution@programming.dev 73 points 1 year ago (1 children)

That when the file isn't minified, no shit it's on line 1 there is only one line

[–] dinckelman@lemmy.world 25 points 1 year ago (1 children)

Production errors at their finest

[–] lord_ryvan@ttrpg.network 10 points 1 year ago (1 children)

Honestly, you don't want production to tell users what your exact errors are, and especially not what the source code looks like and where to find the problem exactly.

Production errors should mostly go “Well, this was on (y)our side, sorry about that” and nothing more.

[–] relevants@feddit.de 5 points 1 year ago (1 children)

If it's in the minified front end code it's already client side, of course you don't show it to the user but they could find out if they wanted to. Server side errors are where you really have to watch out not to give out any details, but then logging them is also easier since it's already on the server.

[–] lord_ryvan@ttrpg.network 4 points 1 year ago

Ah you're right, I'm thinking too much like a backend dev!

[–] shasta@lemm.ee 5 points 1 year ago

Enable sourcemaps

[–] xkforce@lemmy.world 25 points 1 year ago* (last edited 1 year ago) (1 children)

ugh... this reminds me of a compilation error I got that complained about an unknown character. Looked through the file, didnt notice anything, passed it around for other people to check and no one noticed anything until one person noticed that the quotes were being autocorrected to the straight quotes instead for some fucking reason. I didnt see it because 1) why would that even be a thing and 2) I am almost legally blind without my contacts.

[–] TastehWaffleZ@lemmy.world 22 points 1 year ago (1 children)

Yep. I use a piece of software that lets me drag components onto a stage and will auto generate code in the back end. We can then add our own code to customize the components.

I ran into a super cryptic error message while working on a time sensitive project and I was ripping my hair out trying to figure out what the hell was wrong. Turns out someone had pasted some code in from an email and the custom code editor displays the straight quotes and angles quotes exactly the same but the back end code generation fortunately displays them differently. The program didn't like the character set for the quotes used in Outlook but didn't give me the proper line number, the error made zero sense, and looking at the code didn't show that anything was wrong.

[–] uid0gid0@lemmy.world 9 points 1 year ago

Learned the hard way that anything copied from a MS product gets pasted to a plain text editor first. I especially love how SharePoint sprinkles "zero with space" characters liberally throughout.

[–] YellowTraveller@lemm.ee 3 points 1 year ago

I've seen errors on line 0 in the past

[–] n3m37h@lemmy.dbzer0.com 3 points 1 year ago

So I took a Marlin firmware for my 3d printer and just changed values like the bed size and added a BL Touch by uncommenting the specified line and the Visual studio errors out. I don't get it

[–] InvertedParallax@lemm.ee 2 points 1 year ago

Long inline assembler.

Might as well just delete it all and start again.

[–] hperrin@lemmy.world 92 points 1 year ago (1 children)

Even worse: “Error on line 1, column 8,653.”

[–] hakunawazo@lemmy.world 13 points 1 year ago

Laughs in source map file.

[–] ekZepp@lemmy.world 72 points 1 year ago
[–] rockSlayer@lemmy.world 40 points 1 year ago (1 children)

My money is on a nonprinted char

[–] mvirts@lemmy.world 12 points 1 year ago

Curse you, teams!!!!

[–] BeigeAgenda@lemmy.ca 37 points 1 year ago (1 children)

Sometimes I get this when I have unsaved changes to the file or the binary is not in sync with the code PEBKAC, and sometimes its the compiler 🙄

[–] ultratiem@lemmy.ca 12 points 1 year ago

Yeah me too. It’s the compiler. 😏

[–] Yuuki2628@lemmy.world 33 points 1 year ago

See that ;? Take it out for dinner and it may tell you what's wrong here

[–] marcos@lemmy.world 28 points 1 year ago (2 children)

Ha. I've just got a report of "UnknownError at foo in line 162".

Line 162: bar();

Of course, there's a foo() nearby, and yeah the error is there. C# also has a problem with sourcemaps.

Anyway, the "UnknownError" is literal from the problem. And also, nothing has any problem at all, but foo() is from a proprietary 3rd party library...

[–] z500@lemmy.world 26 points 1 year ago (1 children)

Try putting a please; statement in there

[–] demonsword@lemmy.world 2 points 1 year ago

almost funny INTERCAL joke

[–] Knusper@feddit.de 24 points 1 year ago

Kotlin is quite ...special in this regard.

For certain language features, you have to declare functions as inline.
And when you do that, as far as I can tell, it basically just templates that function at the end of the files where that function is to be used.

Because well, it suddenly starts to report line numbers in exceptions, which are beyond the end of the file. Which is not helpful, at all.

[–] zarlin@lemmy.world 13 points 1 year ago (1 children)

This can actually be caused by using mixed line endings. Which is a whole new class of horrible.

[–] Anticorp@lemmy.ml 2 points 1 year ago

You should configure git to checkout and commit specific types of line endings.

"Sourcemaps, what's that?"

[–] Cwilliams@beehaw.org 7 points 1 year ago (5 children)

Yes! Does anyone actually know why this happens!?

[–] irmoz@reddthat.com 17 points 1 year ago* (last edited 1 year ago)

The error is usually with the line before

EDIT: could be a missing bracket:

if (x == 5){
    do_thing();

or a comparison in place of an assignment:

x == 5;
[–] Cube6392@beehaw.org 6 points 1 year ago (1 children)

It depends on what you're using. I see it most often with TypeScript when the source maps are incorrect

[–] Cwilliams@beehaw.org 7 points 1 year ago* (last edited 1 year ago) (3 children)

When I forget a semicolon (in languages that like those), it gives the the error on the next line instead of the one that I forgot the semicolon on. It makes sense once you think about it but, man, it trips me up sometimes

[–] Knusper@feddit.de 6 points 1 year ago* (last edited 1 year ago) (2 children)

Definitely also depends on the language. Here's e.g. Rust, the goddamn overachiever, pointing arrows and everything:

Often feels like, if you know where it needs to go, why ask me?

[–] GamesRevolution@programming.dev 1 points 1 year ago (1 children)

Doesn't rust-analyser have the code suggestions that do fix it for you? It's not fixing automatically, but it does know where it needs to go and it's giving you a button that you click and it automatically fixes it

[–] Knusper@feddit.de 3 points 1 year ago

Oh yeah, it does. I'm not really complaining about fixing it myself. Mostly, I was joking that I felt like I'm unneeded. Rust-analyzer actually being able to fix it on its own, doesn't help in that sense either. 🙃

[–] I_Miss_Daniel@kbin.social 3 points 1 year ago

Error: Unexpected the after the.

[–] Cube6392@beehaw.org 1 points 1 year ago (1 children)

I assumed we weren't talking "expected semicolon" since that ones pretty explanatory and would never appear on a blank line. That said, it does provide an opportunity to talk about the worst code style I ever saw. A dude decided he wanted semicolons at the start of lines so that compiler error always mapped to the line he would have put the semicolon on

[–] Cwilliams@beehaw.org 1 points 1 year ago

At least there's at least some benefit there :P

[–] kherge@beehaw.org 6 points 1 year ago

Some thoughts based on personal experience:

  1. File was edited after error was reported, but before investigating it. (Editing, code formatter, etc.)
  2. Build cache was not cleared, so old source was used.
[–] xilliah@beehaw.org 1 points 1 year ago

If you have optimizations enabled this can easily occur due to code being moved around behind the scenes. For example the body of a small function can be inserted where it is called. For example in c# if you get a null ref exception in such inlined code it will actually direct you to the place where the function is called from, rather than its body.

So if you know, you probably can find the issue. In the worst case just go to debug mode with opti off, or use an attribute on the function to force it not to inline.

[–] folkrav@lemmy.world 5 points 1 year ago

Tears from async JS or transpiled without sourcemaps

[–] naught@sh.itjust.works 4 points 1 year ago

:LspRestart

[–] grue@lemmy.world 3 points 1 year ago

Haha preprocessor goes brrrrrrrrrrrrrrr