debug database error in core.py