lcl: return an appropriate error code