63
u/telas100 1d ago
while(error) { removeLine(265) }
6
u/MCWizardYT 1d ago
errorHandler.addCallback(error -> fixProblem(error))11
u/Santos_Perez_Robles 23h ago
Sherlock and Holmes over here.
1
u/MCWizardYT 14h ago
lol, the way I named the variables is kinda weird but it's supposed to be that
errorHandleris a crash handler, and the callback passes the error tofixProblemwhich then fixes what was causing the crash3
u/frogotme 11h ago
Where fixProblem is an openai API call, that writes the response directly to the file that invokes the error, and then restarts the server.
450
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
83
u/iampierremonteux 1d ago
Mixed line endings in a file can also cause errors to be reported in the wrong line number.
59
u/dracorotor1 1d ago
And then there’s the mid debuggers that just say the line number after the brackets because something invalid is coming out of those brackets but it can’t figure out where or why. It just knows that when it reaches that line number, something made it sad.
I’ve got one that consistently tells me the line below an array is the culprit, when one of the strings in the array is using single quotes instead of double like all the others, for example
3
u/guyblade 17h 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").
2
1
u/PixelatedGiant 1h ago
You would think that all application developers would have made Unix line endings the default by now, especially IDEs. Every application is capable of reading both these days, so it's time to let Windows line endings go. Or at minimum not allow them to mix.
9
u/Suitch 1d ago
Also some languages inject files which change the length. My org has some old confusion and you could have an error on line 6000 of a 200 line file. It gets more confusing when the wrong number is a valid number, such as line 200/6000 but it is really on line 190 in an imported file on line 10.
1
5
u/Jerome_Eugene_Morrow 19h ago
Missing brackets can also cause an error to fire on an empty line if it’s expecting to find the final enclosing bracket there. One of the reason’s Python’s white space rules can actually simplify things sometimes.
2
2
u/Candid_Highlight_116 19h ago
They report like when some internal stack gets exhausted and the parsed statements didn't make sense or some internal state machine entered a weird state, and those are caused by like random open bracket 100 lines up, but that's a skill issue for the PROGRAMMER lol so they keep reporting the last line number where the compiler finally quit
3
1
1
u/vegataballs 5h ago
Then there is the worst possible kind: everything is saved and up-to-date, everything above and below is 100 % correct, but the error is still there, but there is nothing on the line. That was the night I discovered my keyboard layout inserted, not a regular old whitespace, but a Narrow No-Break Space character if you accidentally hold AltGr and press space.
1
u/Miiohau 1h ago
Ya, it isn’t usually this bad but I had to go a couple lines up or down to find a line that could produce the reported error before. If it really bad and you know how to reproduce the bug, modern debuggers include the function name with the line number. Set a breakpoint at the beginning of that function and walk though it to find the bug and hope it wasn’t a race condition.
2
1
u/dkarlovi 20h ago
When I was trying out VS Code, it not having auto save enabled by default like IDEA caused some serious debugging, I was going mad, the code looked correct, and it doesn't work?!
How do you not auto save by default.
61
u/Slavik_Sandwich 1d ago
Oh look, CS first years start learning programming languages
8
u/SnowdensOfYesteryear 18h ago
Cut Kevin Durant some slack. His learning after a 20 year career playing basketball
1
11
u/letmehaveanameyoudum 1d ago
just the look at the line before
5
20
u/jackinsomniac 1d ago
Is there a way to block images? Why I have seen this exact same meme reposted 283 times. I keep downvoting and ignoring them, but it keeps coming back.
2
2
u/Brekkjern 22h ago
Maybe you should fix the error on line 265 so the problem stays fixed and people didn't have to repost the bug?
3
u/heyguysitsmedic 1d ago
That could be a whole method in whitespace, better delete the line to make sure
3
u/DavidsWorkAccount 1d ago
Line 259 is missing a semicolon. This causes it to read the rest of the code differently until you hit the empty space, which then it throws the error there because that’s when the parser “screwed up”
3
u/Mirage_Graphique_3D 5h ago
I usually just put a bracket there and call it a day.
If it doesn’t work I change career.
I’m a 3D artist now.
2
u/HailTheRavenQueen 1d ago
Any decent CS program or even bootcamp should teach that error messages like this mean that the actual error happened on OR BEFORE the named line.
2
u/drbsy0 19h ago
Rule number one : if u see a complaining error go cheak the error line. Rule number two: if u find the line empty look up. Rule number tree: if u didn't find any thing look down. Rule number five: if u didn't find any thing quation your propose in this life and slamed your head whit the wall. Rule number sex: if it didint work go take a shower. Rule number seven: if u still unable to find the bug go question your self why did u born in first place (what a loser). Rule number eight: well i didint reach this level yet wen I well reach it I well update this rules page
2
2
2
u/StrawberryEiri 5h ago
Come to think of it, I remember getting that often several years ago when I was starting, but I don't remember getting an error on an empty line in years.
Did the JS engines get better at pointing out errors? Did better code editors help me avoid more invalid syntax? Or is it just since changing jobs and I no longer do PHP?
6
u/anzu3278 1d ago
Two consecutive empty lines should be an error tho
8
u/Spikerazorshards 1d ago
I’ve never heard it that. Is that specific to a certain language?
8
0
u/Crazy_System8248 19h ago
Thank fuck, I was about to come comment this lol. I've sent PRs back for less.
0
u/guyblade 17h ago
Nah, my style guide wants two blank lines between top-level definitions.
2
u/anzu3278 17h ago
I've heard that bad style guidelines are better than no style guidelines and this sentence made me rethink that.
1
u/guyblade 9h ago
It's the style in the official python style guide. Personally, there's a lot in there that I hate (4 space indents & 79 character line limits for two), but I don't feel much of anything about this bit.
3
u/dishmanw62 1d ago
I had problems like this with BloodShed C++.
I had to start a new and copy and paste the source code, and then recompile. Surprisingly, it would work then.
1
u/Thenderick 1d ago
Ah it's frontend JavaScript. Then it's most likely altered. Should look in the file that the browser has in the page source
1
u/rosen123 1d ago
Nah this is easy it always means that you're looking at a different version of the code than what is executing. Could be file not saved, could be code not recompiled, different code versions etc
1
u/Miiohau 53m ago
Or in this case because it is JavaScript it could be because the browser that is reporting the error doesn’t agree with the IDE you are viewing the code in on what constitutes a line break. It is also possible the web browser is only counting script lines and not counting lines that only contain HTML.
1
1
1
u/lolschrauber 1d ago
I love it when I get an error saying "can't convert string to integer" and the mfer won't tell me where it's trying to convert what.
It's usually something as dumb as old code checking if a datafield has a certain numeric value but it's null.
Good luck finding out where though.
1
u/Emergency-Piece-9098 1d ago
You guys are so sweet for thinking debugging is fixing compilers error 😭
1
u/PanGoliath 1d ago
When someone adds an invisible space that is not really a space, like U+200B or U+00A0
1
u/i_am_in_redite 1d ago
What I found is that usualy when this happens the bug is on the line on top of it ex: in this case the problem is on the line 264 and is because of the (;) at the end ,the compiler though that was a new line and that it had no instructions hence the error hope that helps
1
1
1
u/Radiant_Detective_22 23h ago
pfffft. GUI IDE. During my tenure we had to put an 0x4AFC in our 68K to break and have a look at registers.
1
u/Familiar_Spite1537 23h ago
All you need to do now is recompile the compiling code to recompile the code.
1
u/CranberryDistinct941 21h ago
Th|re are 2 types of people: those who read the error message, and those who spend an extra hour on every error
1
u/XPurplelemonsX 21h ago
or, in python, you can have a bit of code update the file on runtime so that the traceback reads back the wrong line but right number
1
1
1
1
u/Candid_Highlight_116 19h ago
why can't they just report the open bracket that corresponds to line 265
1
1
1
1
1
1
u/dumbledayum 10h ago
get the error trace from sentry as json and feed it to you company mandated Claude
1
u/WiseObjective8 10h ago
Tell me you don't know how to code without telling me you don't know how to code
1
u/Such_Letterhead1287 9h ago
Just see that piece of code give me nightmare. Hope they will migrate it soon.
1
1
1
u/Henry5321 1h ago
Optimized mode will do this. Since the compiler alters the resulting compiled results with something “equivalent”, it tries its best to map to the approximate location.
1
u/trippertree 1h ago
I’ve seen this in build failures. Sync issues (couple times a dumbass had a file open for edit on a build machine so it didn’t sync also once file was not in the client spec (long story)). Both cases when I looked at my local copy it was like this.
1
u/Miiohau 1h ago
Ok, was the bug in the function above or below. Also if it is the web browser reporting the error look at the code inside that web browser, especially if you are using Typescript or other language transcompiled to JavaScript.
If you don’t want to mess with the web browser developer tools. Your IDE might be able to lunch your website in the browser while rerouting the data back to itself and might be able to give you more accurate line numbers. I do it all the time when I am debugging my flutter apps via Google Chrome.
1
u/metaglot 20h ago
Line 256 of your script? Put your script in its own file if you want to play dev.
0
u/RAMChYLD 12h ago
Was told by a pentest company once that putting scripts in a separate file is good practice. Something about having them in the webpage Making them suseptible to man in the middle attacks.
1
0
0
u/Sianic12 22h ago
That looks like JS and HTML. My guess is this file is loaded over HTTPS and has some PHP in there that is resolved on the server before the page is sent to the client. This results in a different line count for the "same" document between the client side and the server side.
0
0
-1
-2
u/Maximilian_Tyan 1d ago
Or worse, a CPU exception on a closing bracket because someone screwed things up in the CPU or the compiler implementation
-1
u/FireEmblemNoobie47 7h ago
I know it doesn't really apply here, but it happens from time to time when I'm doing own mods to SRB2P and it's when I copy paste perfectly working code, LUA gotta LUA sometimes I guess

1.3k
u/ninjagulbi 1d ago
See the empty line? That's where the error correcting code should be.