AEM Author preview 404 error caused by malformed page in custom carousel component

This article describes how to resolve a 404 error in Adobe Experience Manager (AEM) Author preview when a custom carousel component references a malformed or empty page, resulting in a rendering failure.

Description description

Environment

  • Adobe Experience Manager (AEM) Author
  • Custom carousel component using a Sling Model

Issue/Symptoms

  • Previewing a page in AEM Author that includes a custom carousel component result in a 404 error.
  • The error occurs when the carousel references a malformed or empty page.

Cause

The issue occurs because of a NullPointerException in the custom Sling Model used by the carousel component. The model does not handle missing or invalid pages. If a referenced page has no child nodes or content under the expected path, the component fails to render and returns a 404 response.

Resolution resolution

Follow these steps to resolve the issue:

  1. Review the list of pages referenced by the custom carousel component in your AEM site.
  2. Identify pages that are empty, malformed, or missing the required content under the expected path.
  3. Remove or correct any invalid or empty pages in the repository.
  4. Update the custom carousel component code to handle missing or malformed pages gracefully.
  5. Ensure that the component skips invalid entries instead of causing a failure.
  6. Test the affected page in AEM Author preview to confirm that the 404 error no longer occurs and that the carousel renders as expected.
recommendation-more-help
experience-cloud-kcs-help-kbarticles