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:
- Review the list of pages referenced by the custom carousel component in your AEM site.
- Identify pages that are empty, malformed, or missing the required content under the expected path.
- Remove or correct any invalid or empty pages in the repository.
- Update the custom carousel component code to handle missing or malformed pages gracefully.
- Ensure that the component skips invalid entries instead of causing a failure.
- 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