Message
foo
is not a valid URI
Explanation
The URL contains an invalid character. A complete list of acceptable characters can be found in RFC 3986.
Solution
Remove any leading and trailing whitespace. Replace invalid characters with the proper escape sequence. For example, "{" and "}" characters should be replaced with "%7B" and "%7D" respectively.
Not clear? Disagree?
You might be able to find help in one of these fine resources.