return JSON encoded error inside serve_request()