Loading

Marketing Cloud Engagement Use Content Builder email preview to troubleshoot CloudPages 500 errors

Date de publication: Nov 12, 2025
Description
 

Often times, you may want to use AMPScript in CloudPages to accomplish a business need. If there are AMPScript errors, the CloudPage will fail to load with a 500 error. Take the below as an example.

%%[
SET @VAR = lookup('test123', 'attribute', 'subscriberkey', _subscriberkey)
]%%

%%=v(@VAR)=%%
 

While this appears to be valid syntax, this AMPScript will cause your page to fail to load with '500 - Internal server error.'

Résolution

Recreate the AMPScript in Email Studio

  • Copy the AMPScript from the CloudPage
  • Go to Content Builder | Create | Email Message | Creation Method HTML 
  • Give the Email a name, next
  • Paste the AMPScript into the left content pane
  • Give the email a Subject, next
  • Follow the Perform a Subscriber Preview and Test Send documentation to do a Subscriber Preview
  • Note the errors similar to below

     
The subscriber preview failed to generate. Review the details, correct all issues, and try again.
HTML Version

    There is an error in your email. Please contact your customer service representative. Error 1: Script SET Statement Invalid<br>An error occurred when attempting to resolve a script expression. 
See inner exception for detail. Script Expression: lookup('test123', 'attribute', 'subscriberkey', _subscriberkey) MemberID: 6400278 JobID: 0 The Data Extension name for a Lookup function call is invalid. 
A Data Extension of this name does not exist. Data Extension Name: test123 Function Call: lookup('test123', 'attribute', 'subscriberkey', _subscriberkey) Parameter Name: DataExtensionName 
Parameter Ordinal: 1 <br>Invalid Content: <br>SET @VAR = lookup('test123', 'attribute', 'subscriberkey', _subscriberkey)
 

From here, you can see that the Data Extension used in the Lookup() function does not exist. You can now correct this error and re-publish your CloudPage.

Note: Be aware of some AMPScript functions that only work in Email or CloudPages exclusively.  These will have to be considered when performing the validation.

Example: InsertDE AMPScript can only be used in an email, but not in CloudPages. However, InsertData cannot be used in an email send, but can be used in CloudPages.

Numéro d’article de la base de connaissances

000383780

 
Chargement
Salesforce Help | Article