Agent error handler