How can I trace the source of a redirect error listed in Administration -> Reports?
If you know the name of the failing redirect URI (such as user/register), the best is to scan through your database and look for redirect entries, e.g. using drush:

drush sql-dump --ordered-dump | grep "user/register"




Alternatively add dd() (from Devel) into drupal_goto() and log the backtrace of each call into the file, e.g.

dd(debug_backtrace(FALSE, 5));


and check drupal_debug.txt in your tmp folder.



Another trick include using DTrace and hook into static probes (if your PHP supports that: php -i | grep dtrace), for example (after running the script):

sudo dtrace -qn 'php*:::function-entry { printf("%Y: PHP function-entry:\t%s%s%s() in %s:%d\n", walltimestamp, copyinstr(arg3), copyinstr(arg4), copyinstr(arg0), basename(copyinstr(arg1)), (int)arg2); }'


then you may grep it and look for specific functions such as drupal_goto, so you may append to above:

| grep -B5 drupal_goto &gt; trace.txt


so this will log into file all calls to drupal_goto with 5 function calls before.

See also: How to generate the function stack trace of the last request made?