MALFORMED_ID: meaning and how to fix it
Quick answer
MALFORMED_ID: A value passed as an ID is not a valid 15 or 18 character Salesforce ID (wrong length, stray characters, or changed case in an 18-character ID). Start with: Check for whitespace, quotes or truncated values in the ID.
Typical message: MALFORMED_ID, malformed id 001XXXXXXXX
Cause
A value passed as an ID is not a valid 15 or 18 character Salesforce ID (wrong length, stray characters, or changed case in an 18-character ID).
How to fix MALFORMED_ID
- Check for whitespace, quotes or truncated values in the ID.
- Convert and validate the ID with the ID converter.
- In SOQL filters, compare an ID field with a valid ID, not a name or a label.
Have a different message? Paste it into the error decoder, which matches it against 45 common Salesforce errors in your browser.
Frequently asked questions
What does MALFORMED_ID mean in Salesforce?
A value passed as an ID is not a valid 15 or 18 character Salesforce ID (wrong length, stray characters, or changed case in an 18-character ID).
How do I fix MALFORMED_ID?
1. Check for whitespace, quotes or truncated values in the ID. 2. Convert and validate the ID with the ID converter. 3. In SOQL filters, compare an ID field with a valid ID, not a name or a label.
More Data and DML errors
SFDX Talk is unofficial documentation. It is not affiliated with, endorsed by, or sponsored by Salesforce, Inc. Message text varies slightly by release and context, so confirm against the official page before relying on it.