No id provided SQL error fixed

Addressed a rare SQL error. Its causes are still unknown, but at least
now a friendly error is produced.