Just wanted to share a few quick tips for debugging. If you're using /bin/bash to run a script, you can add "2> error.log" to output errors to a file. Example:
ruby script.rb "{query}" 2> error.log
All errors will then be logged to error.log in your workflow's folder.
Or if you want all output logged (perhaps so you can view the xml from a script filter), you could use tee:
ruby script.rb "{query}" 2>&1 | tee output.log
That'll log errors from stderr in addition to standard output. Note that PHP doesn't output to stderr, so if you're using PHP you'll have to check PHP's error log instead.
Also, if you have any formatting errors in a script filters' XML, Alfred will log it to Console.app.
Hope this helps, and feel free to share your own tips.