You probably need to return 'localhost' or something default after this error.