AEM Cloud Manager deployment fails due to HTL compilation errors in client library resources

✨ This content is AI generated and could be inaccurate. Generative AI Terms

This article explains how to resolve Cloud Manager deployment failures caused by HTL compilation errors when JavaScript template literals in client library HTML resources are misinterpreted by the AEM parser.

Description description

Environment

  • Adobe Experience Manager (AEM) Cloud Manager (all versions)

Symptoms

Cloud Manager builds fail during the Deploy step across all environments (Development, Stage, and Production). Pipeline logs show HTL compilation errors in client library resource files. The parser reports errors such as:

  • mismatched input '(' expecting {'}', '@'}

Affected resources include HTML files within client libraries that contain JavaScript template-literal expressions (e.g., ${getAccessToken()}) in .html files. These are interpreted as HTL expressions, causing parser errors during deployment.

Cause

Deployment fails because JavaScript template-literal expressions (${...}) within .html client library resources are interpreted as HTL expressions by the AEM parser, resulting in syntax errors during the HTL compilation step.

Resolution resolution

Follow the steps below to resolve the issue.

  1. Review the affected client library resource files in your codebase (for example, HTML files within /apps/.../clientlibs/.../resources/).
  2. Check for JavaScript template-literal expressions using the ${...} syntax within these .html files.
  3. If these expressions are intended as JavaScript, ensure they are not interpreted as HTL expressions by the AEM parser.
  4. Move JavaScript code containing template literals to .js files instead of embedding them directly in .html resources. Alternatively, escape or refactor the ${...} syntax to avoid HTL parsing conflicts.
  5. Re-run the Cloud Manager pipeline to verify that the HTL compilation errors are resolved.
recommendation-more-help
experience-cloud-kcs-help-kbarticles