Warning message in JSON-API " Illegal header: Illegal 'origin' header: Illegal origin: Invalid input '/"

The Trying to look up template error comes from the JS codegen. My guess is that you ended up in an inconsistent state for some reason. I recommend following the instructions in Daml-ui-template React function and Action with 2 arguments to try and fix it.

Side note: The DB schema used by Sandox on Postgres is considered an implementation detail and not something you should rely on. To answer the query you used here you can use the package management service on the ledger API instead.