Grails – A previous call to redirect(..) has already redirected

grails

In Grails app, occasionally seeing "Cannot issue redirect" in logs:

2011-04-27 12:18:40,469 [TP-Processor13] ERROR GrailsExceptionResolver – Cannot issue a redirect(..) here. A previous call to redirect(..) has already redirected the response.
org.codehaus.groovy.grails.web.servlet.mvc.exceptions.CannotRedirectException: Cannot issue a redirect(..) here. A previous call to redirect(..) has already redirected the response.
at com.coach.LoginController$_closure2.doCall(LoginController.groovy:90)

Not sure how to track this down. Any ideas or suggestions?

Todd

Best Solution

Check the login controller; it seems like you are not returning from the action after redirect. E.g.:

if (some condition) {
    redirect ()
    return  // should return from here to finish the action, otherwise the rest of the code will be executed
}
Related Question