frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

Ask HN: How to fix issue and find the origin of bug in codebase?

5•timonpimba•9mo ago
I wondered how you people approach a bug problem in the issue section. I have never done these things. Since last week, I've been trying to understand the bug's real issue/origin. I couldn't solve it. Initially, I used git bisect and looked into commits & code. I still couldn't figure it out.

If I could understand how you approach these bugs and how they are fixed, what method do you use, and how do you look at the code to fix them? Then, honestly, it would be invaluable to me.

Also, if you could please share any resources or articles, I would be very interested in looking at them; I could take some lessons from them.

Thanks.

Comments

dcminter•9mo ago
One iterative approach; step zero, though, is to be sure you understand what the bug is:

• What happens?

• What did you expect to happen?

If they're the same then NOT A BUG, and WONTFIX :D Assuming it's a bug, the next important thing is to be able to reproduce it. Ideally with a test case. A test case allows you to:

• Rapidly test whether your fix (when you have one) has worked

• Ensure that the bug doesn't reoccur (avoid "regressions")

Sometimes it can be very hard to reproduce a bug, but of course if you can't reproduce it you will never be sure your fixes have worked.

The bug spotting process consists of iterations of:

• Gather data

• Form hypothesis

• Test hypothesis

It's basically the scientific method. Data can be all sorts of things; events occurring in logs, facts about the user's interaction, versions of databases etc. If you have no hypothesis about what's going on, gather more data until you do.

Oh and write your data, hypothesis, and test results down somewhere so you don't get into loops of trying the same thing or think you've tested things that you haven't or know things that you don't.

A hypothesis can be as simple as "maybe it's the version of the database" and the test being "change the version of the database and see if the bug disappears" ... or it could be something more complicated and convoluted ("When this thread does this thing and that one races it to do this other thing with this particular piece of input data then....")

If you were able to reproduce the problem, your hypothesis was correct and the test indicated that you had resolved it, then you're good to go. Then it comes back next week and you discover it was slightly more complicated than that ;)

It's a skill and it improves with practice. Good luck.

---

Edit: Originally I wrote "two approaches" but then realised I really just have this one, but one variant of it is "I recognise something I had at the back of my mind when I was writing the code in the first place" - but that's really just that I already have the data, form the hypothesis off the back of that, and still have to test it to be sure.

Also, before you WONTFIX ... do consider why your expectations and the reporters' expectations conflict. Is your documentation confusing? Are your expectations out of whack with what real users want? Most people aren't just idiots, so a raised bug usually indicates that something is wrong even if it's not the code.

timonpimba•9mo ago
Love you, man. Thanks very much for replying. Honestly, I thought I have asked a very dumb question with respect to the HN standard, which is why I had not received any replies until yours.

I'm a beginner programmer and a Mathematics Undergrad. I learned C++ and thought of applying it to real-world things. So, I picked a GitHub repo and a "good first issue" and started working on it; I was stuck for a long time.

I think this is a fundamental skill that is talked about very little, and strangely it has not been covered on YT, also couldn't find articles.

But I'll keep trying to learn it. As you said, I'll need to do more practice.

You are very kind person. Thanks.

dcminter•9mo ago
It's definitely not a dumb question - it's something that just wasn't taught at all when I was at University.

My answer, of course, is a bit broad-sweeps. The nitty gritty will depend on the project etc. In your case, if it was flagged as "good first issue" it's probably a relatively small self-contained bug (or the reviewer thought that - they might have been wrong). Well worth seeing if one of the project members can give you a hint.

I wish I could point you to more material but I don't have much at my fingertips. There's a chapter on debugging in "The Practice of Programming" by Rob Pike that I recall being good, but it might be a bit antiquated.

It's worth bearing in mind that there are innumerable different types of bugs and different languages are more or less vulnerable to some of them (e.g. you'll never use-after-free in Java, but you can leak memory just as easily in Java as in C++ - and out-of-memory issues might be a little more likely in a profligate language like Java)

For C++ there are some excellent books by Scott Meyers which, if they've been updated (I was last a C++ dev before 2000) contain a host of little gotchas that can lead to all sorts of weird problems. But hopefully the one you're investigating will be something more straight-forward.

> You are very kind person. Thanks.

It's genuinely a pleasure; I think this is a super-interesting topic. Also I think that debugging is one of the most fun bits of software development - though I know a lot of people would disagree with that!

chistev•9mo ago
Let's say the bug occurs when you click a button. So you go to the part of the codebase that has logic involving that button, and you analyze the associated functions, if any.

Show HN: Readability API – Unrender

https://unrender.page/
1•zintus•1m ago•1 comments

My Grandma Was a Fed – Lessons from Digitizing Hours of Childhood

https://sampatt.com/blog/2025-12-13-my-grandma-was-a-fed-lessons-from-digitizing-hundreds-of-hour...
1•SamPatt•7m ago•0 comments

Show HN: I built a free, open-source macOS screen recorder with modern features

https://github.com/jsattler/BetterCapture
1•jsattler•7m ago•0 comments

RFC 3092 – Etymology of "Foo" (2001)

https://datatracker.ietf.org/doc/html/rfc3092
1•ipnon•8m ago•0 comments

Prove_it – Force Claude to verify its work

https://github.com/searlsco/prove_it
1•mooreds•9m ago•0 comments

Benchmarking On-Device LLMs on iPhone and iPad Using MLX

https://rickytakkar.com/blog_russet_mlx_benchmark.html
1•nullnotzero•12m ago•0 comments

Matthew Perry and Jennifer Aniston Did an Advert for Windows 95 [video]

https://www.youtube.com/watch?v=7q1hDDtJAN8
1•megamike•15m ago•0 comments

We tested a transport app that cost the public £4M against Google Maps

https://www.bbc.co.uk/news/articles/c9wx97jv7qeo
1•mmarian•18m ago•0 comments

Introduction to Abject-Oriented Programming (2007)

https://typicalprogrammer.com/introduction-to-abject-oriented-programming
2•simonpure•18m ago•0 comments

Boil the Ocean

https://garryslist.org/posts/boil-the-ocean
3•alexpogosyan•18m ago•0 comments

Show HN: I built an open-source Gmail productivity app that auto-labels emails

https://github.com/Lakshay1509/NeatMail
1•mafia15•20m ago•0 comments

AI fatigue Is real and nobody talks about it

https://siddhantkhare.com/writing/ai-fatigue-is-real
2•sidk24•21m ago•2 comments

Takaichi leads LDP to crushing victory in Japan election

https://www.ft.com/content/0456cd13-8eda-40fd-90f3-b16d986e50ad
1•mmarian•23m ago•0 comments

Sidecar – your AI-accelerated development workflow in one shell [video]

https://www.youtube.com/watch?v=5QZxWmDl_tc
1•kingforaday•25m ago•1 comments

Chinese CXMT and YMTC increace output with new fabs amidst shortage

https://economy.ac/news/2026/02/202602287605
1•TEHERET•26m ago•0 comments

Show HN: Breakpoints.cc – visual crypto price trajectory forecasts

https://breakpoints.cc
1•ewrwerwerwR•27m ago•0 comments

I am happier writing code by hand

https://www.abhinavomprakash.com/posts/i-am-happier-writing-code-by-hand/
1•lazyfolder•28m ago•0 comments

AzoBiPy – stable organic redox flow battery compound

https://nouvelles.umontreal.ca/en/article/2026/02/04/saving-sunny-days-for-a-rainy-day-a-new-mole...
1•imhoguy•28m ago•1 comments

Why don't jet engines melt? [video]

https://www.youtube.com/watch?v=QtxVdC7pBQM
1•ksec•28m ago•0 comments

All in One YouTube Toolkit for faceless channels

https://viralvelocity.app/
1•coreycascio•29m ago•2 comments

Teaching Computers to Laugh

1•denkern•30m ago•0 comments

Exploring a Modern Smtpe 2110 Broadcast Truck

https://www.jeffgeerling.com/blog/2026/exploring-a-modern-smpte-2110-broadcast-truck-with-my-dad/
1•assimpleaspossi•31m ago•0 comments

ToolFK is a world-leading online toolkit for developers

https://www.toolfk.com/
1•zhouhua•32m ago•0 comments

Authentically Authoring: Maintaining a 300k-word sci-fi world without AI slop

https://ellerushing.com/elles-blog/authentically-authoring-ai-slop
1•kpinkerman•36m ago•3 comments

Running Your Own As: BGP on FreeBSD with FRR, GRE Tunnels, and Policy Routing

https://blog.hofstede.it/running-your-own-as-bgp-on-freebsd-with-frr-gre-tunnels-and-policy-routing/
2•todsacerdoti•37m ago•0 comments

A Security Site

https://asecuritysite.com/
1•ubavic•38m ago•0 comments

Deep Dive into Hierarchical Navigable Small Worlds (HSNW)

https://amandeepsp.github.io/blog/hnsw/
2•amandeepspdhr•38m ago•0 comments

Show HN: Verification-first workflow plugin for Claude Code

https://github.com/doodledood/manifest-dev
1•doodledood•39m ago•0 comments

Falcons Flight – Longest, Tallest and Fastest Roller Coaster

https://sixflagsqiddiyacity.com/en/explore/rides/falcons-flight
1•thunderbong•39m ago•0 comments

The Little Learner: A Straight Line to Deep Learning

https://mitpress.mit.edu/9780262546379/the-little-learner/
1•AlexeyBrin•39m ago•0 comments