I have read numerous posts from people who have had their gallbladder removed and have gone on in later life to take codeine for pain relief.  This has led to severe pain, possible due to spasm of bile duct/sphincter of oddi. I too suffered the exact same issue. My gallbladder was removed in 2013. I injured my back in 2017 and was prescribed codeine (30mg) and took 2 tablets. Within 20 minutes or so, I began to feel pain just below my ribs, centre and right hand side. I didn't immediately make the connection. I took 2 further codeine several hours later. Wow, big mistake! The pain was horrific, (almost as bad as a gallstone episode!) and lasted several hours which kept me awake nearly all night. I searched several sites on the net and discovered numerous complaints from similar sufferers and the consensus is that codeine is opiate based. I had some tramadol at home, which is comparable to codeine and I tried this and went on to suffer no side effects (bile duct/SOO) whatsoever. Just a share in the hope it helps someone!