Question: I am an amateur bass guitar player. At some point I decided to do something about my lack of theory knowledge.

Now I know a few basic scales and can read sheet music in simple keys (from zero to one to two flats/sharps). I understand in general how chords are built on degrees of the scale and know some basic ones. I understand what V/vii etc chord means. I know where notes on the fretboard are located.

But when it comes to real practice with a band, I'm completely lost. I can't seem to apply this knowledge in the process and reduce to catching roots by ear and playing cliches which often don't match the key and chord, and as I discover it I start alternating them nearly randomly (with the scale in mind if I'm happy enough to see it on the fretboard) until it sounds OK. 

**How do I bridge the gap between the theory and practice and start using the knowledge**?

Answer: 
write musical analysis of your favorite bass lines, many bass players play Bach and other classical music which have plenty of writings of musical theory explaining them, train your ears to develop stable relative and absolute pitch and clear sense of harmonies, play a fretless contrabass, however it is an expensive and loud toy...
The funny thing is, it's a lot easier to understand music theory than it is to understand how music theory will help your playing. It follows that spending time understanding the theory is time better spent than time trying to understand how it's helping.

When you're with the band, just put theory out of your mind completely. If you have to think about it, then you're not ready to use it anyway, and it just clogs up what should be an enjoyable an creative endeavour.

Remember that music theory comes from how music is practised, not the other way round. It's far more valuable to notice that C, E and G sound great over C major chords, and that adding a B to that sounds markedly different to adding a Bb, even though they both work (depending on the context). The fact that you're then using C Ionian or C Mixolydian (which differ by one note, namely B/Bb) is only a way to describe what your ears have worked out already.

Play when you're playing, study theory when you're studying, and trust that they will indeed converge and enrich each other.