What do you mean by “keep on failing?” Do you mean you hit a wrong note? Do you mean that you didn’t have a super deep musical connection the first time you played with a new group? Either way, this is a loaded question with quite a few answers in what you can do to maximize your ability to play with a new group.
Alter your ears
Are you familiar with the type of music being played? It’s sad to say, but most music gets summed up into a genre that may be different from your understanding of it. For instance, in a Church Worship set, I’ve had to go from playing what I would play in a Country or Bluegrass set, to a full on 8th note punchy pocket-rock, to the next song having a Latin backbeat. There’s a lot of variability in the styles that get lumped together in any set, whether classical, rock, blues, jazz, country, metal, etc. I mean if you were to go play with a rock cover band on the club scene, you could be playing something like When The Levee Breaks by Led Zeppelin to playing Spoonman by Soundgarden to Broken by Lonelytheband without skipping genres, let alone the playing in a classical ensemble where you could be going from Beethoven to Bartok. Unfortunately, there’s way to much recorded music to listen to in a lifetime.
Alter your practice routine
This may seem like a no-brainer to some, but suffice it to say You play what you practice. If you’re a guitar player with a blues background playing with a new blues group, and have been neglecting someone important in the repertoire of the group (e.g. you’re more Texas blues, and they’re more Chicago blues) ask for some influences and check them out on YouTube, Spotify, Apple Music, etc. You may find that playing something less like SRV and more like someone else would work. Likewise, if you’re a “Pocket” bass player who hasn’t had a lot of time listening to a lot of Bebop or Hard Bop and your group wants to put together a ripping cover of Giant Steps, you better get listening to some Coltrane… Pronto!
Alter your expectations
You’re going to hit a few bad notes. Whether it’s in practice, or at a gig. What differentiates the guys everyone looks up to from the guys no one wants to hear is being able to turn the bad notes into good notes. Whether it’s a slide or a bend, or owning the bad note to create a “cool harmony” is up to you. Why not turn an accident into a happy accident. The truth is you shouldn’t let it fluster you or dwell on the atonality of the note. The truth is, there are 12 whole tones in Western music and all work together in different scenarios. The truth is this: Music is beautiful in every way, shape and form. Learn to love it.