search: fix a bug that search doesn't return error response with "records" output