Ensure 'error' handler has correct function signature