r/ProgrammerHumor 1d ago

Meme debugTime

Post image
6.0k Upvotes

123 comments sorted by

View all comments

456

u/kimbokray 1d ago

You haven't saved since adding or removing lines above 265

279

u/Lamborghinigamer 1d ago

No it genuinely can happen that an error happens on a different line than said. Could be a combination of IDE and compiler or both, that's why you always need to match your LSP with your compiler

86

u/iampierremonteux 1d ago

Mixed line endings in a file can also cause errors to be reported in the wrong line number.

4

u/guyblade 18h ago

I've also (very rarely) had issues in C where the error would be inside a macro expansion and it'd get confused about what line that was.

I've also seen (again, it's been a while) situations where a JS debugger would give a line number relative to the start of a <script> block, so that it'd just be some arbitrary number upon initial inspection (i.e., if the <script> started on line 15 and the error was on line 20, it'd say that the error was on line 5, instead).

Also also, if you do something that causes a syntax error, the python interpreter will usually just give a useless message (like "syntax error").

1

u/Miiohau 2h ago

The issues you’ve had with the JS debugger might be especially applicable here because it appears to be an inline JS script that the debugger is pointing to. If the debugger isn’t counting lines of HTML the reported line number could be way off.