What if bitcoin has a bug? If a fundamental bug is found in bitcoin does that mean that the only way to patch it would be a hard fork? I'm confused at how this software that only has one version is running for 10 years without even a bug?
If a fundamental bug is found in bitcoin

Bitcoin is mainly two things

A set of Network protocols and associated rules by which Bitcoin wallets can interact with each other and by which mining software can interoperate with other bitcoin software.

A reference implementation of a Bitcoin wallet. This is the &quot;bitcoin core&quot; software application.


Network Protocol
Exploitable weaknesses in the network protocols and rules can be fixed by a soft fork which changes or extends the protocols or rules.
Software

this software that only has one version is running for 10 years without even a bug?

See the release notes for bitcoin core
for example, the notes for 14.3 include

Denial-of-Service vulnerability CVE-2018-17144 ——————————-
A denial-of-service vulnerability exploitable by miners has been discovered in Bitcoin Core versions 0.14.0 up to 0.16.2. It is recommended to upgrade any of the vulnerable versions to 0.14.3, 0.15.2 or 0.16.3 as soon as possible.

Other implementations (e.g. Electrum) also have exploitable flaws discovered and fixed from time to time.