You just can't keep any system bug free, the only thing you can do is improve your detection systems, codebase, and documentation and over time bugs will pop up less and less
* Make illegal states unrepresentable
* pure, static functions wherever possible
* use test generators (a la quick check)
* if you can't unit test important code, try refactoring until you can, rather than immediately reaching for integration tests and mocks.
I don't think you'll be able to model your system well enough to be able to run it through a formal language (I'm thinking about TLA+). But Leslie Lamport did say something about "the algorithm is not the code". That is, if you have any tricky algorithms that you invented for this project, you can formally prove those algorithms in TLA+ and then translate them to code.
> unit testing not very useful because ultimately it's not a single component that generates errors but the interaction between many of them
in some contexts a high (or even low) defect rate is completely unacceptable, the cost of a major defect can be ruinous to users / customers / the business --- e.g. if defects in the product can kill large numbers of people, or if defects would cause a giant batch of cash trapped in manufactured hardware products to be recalled, or if defects could cause the company to lose money very very quickly (c.f. the knight capital automated trading feature flag thing). but many contexts aren't like this at all.
Count yourself lucky. Most teams find it impossible! :)