AlgodHTTPError from smart contract call

Hi all, not sure if this is the best place to post this - I’m new to this, sorry!
I’ve been getting AlgodHTTPError from sending transactions for smart contracts to opt-in on foreign asset. Below is part of the error.
What’s frustrating is that I’ve had the exact same code running just fine and suddenly it breaks. Running out of ideas here. Would really appreciate any thoughts

\AppData\Local\Programs\Python\Python39\lib\site-packages\algosdk\v2client\algod.py", line 89, in algod_request
raise error.AlgodHTTPError(e, code)
algosdk.error.AlgodHTTPError: TransactionPool.Remember: transaction KEC3WIP6IB6P45OHGVAMQQKF2IXY63TWXZVWY5KDB2TJQTUTIJEA: logic eval error: assert failed pc=404. Details: pc=404, opcodes=app_global_get

Another error when running pretty much the same code, could this be correlated?

in waitForTransaction  
    raise Exception(
Exception: Transaction FR364ZNOSOMNQPXRW7DFNJFDF7MBNCJFPGOVQWNRD5LY2NAV24ZA not confirmed after 10 rounds

Let me know if any more information would be helpful,
Thanks!

The error is the following:

logic eval error: assert failed pc=404. Details: pc=404, opcodes=app_global_get

There is an assert in your code that fails and this assert seems to involve app_global_get.
Now, the best solution is to debug the call.
You can see a solution using goal there:

You can also create the “dry run” directly from the SDK:

Look at