Working as Expected
Platform / ALM
[Spring 21] - Named Credentials throws "System.CalloutException: The URI is invalid" when special characters are in URL
Summary
When utilizing named credentials in an apex callout.
If the callout contains special characters such as a square bracket, this will fail the request with the error
"System.CalloutException: The URI is invalid" when this was working in previous release.
Ref:
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_callouts_named_credentials.htm
If the callout contains special characters such as a square bracket, this will fail the request with the error
"System.CalloutException: The URI is invalid" when this was working in previous release.
Ref:
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_callouts_named_credentials.htm
Workaround
We haven't loaded the full details for this issue yet. Check the official page.
History
First tracked here as Working as Expected
Nov 30, 2026