No able to delete object

When I call <?php $item->delete(); on a simple model, I get: "Exception: Trying to call method getshared on a non-object"

Delete function is not extended. What could possibly cause this?

php 7.3.16, phalcon 4.0.6 (Mac, installed with macports)

I have doubts that that line is what's causing the error.

getShared() is a method defined on Phalcon's Dependency Injector component. It looks like you're calling getShared(), but the DI container doesn't exist.

When trying to delete, Phalcon would access the DB service which is defined in the DI container, so that might be causing it. But Phalcon would have already accessed that when querying the DB to retrieve the item you're now deleting.

More code would help.