Content can’t be published

The issue was fixed after replicating the /var/structure from Production to Stage and restarting the AEM on Stage Publishers.

Description description

Environment
Adobe Experience Manager (AEM)

Issue
The Stage publisher isn’t working properly, and you can’t publish content on this instance.

These type of errors are seen in error.log:

20.09.2022 06:53:27.635 *INFO* [ discovery.connectors.common.runner.artewte0-3885-4755-990b-f2d7574839269.discoveryLiteCheck]  org.apache.sling.discovery.base.commons.BaseDiscoveryService getTopology: undefined cluster view: REPOSITORY_EXCEPTION]  org.apache.sling.discovery.base.commons.UndefinedClusterViewException: Exception while processing descriptor: java.lang.IllegalArgumentException: Can't create child on a synthetic root
20.09.2022 06:53:29.636 *ERROR* [ discovery.connectors.common.runner.a0gfdwsgt0-3885-4755-990b-f2d776738269.discoveryLiteCheck]  org.apache.sling.discovery.oak.cluster.OakClusterViewService getLocalClusterView: repository exception: java.lang.IllegalArgumentException: Can't create child on a synthetic root
java.lang.IllegalArgumentException: Can't create child on a synthetic root
at org.apache.sling.resourceresolver.impl.ResourceResolverImpl.create(ResourceResolverImpl.java:979) [ org.apache.sling.resourceresolver:1.7.2.B0001]
at org.apache.sling.api.resource.ResourceUtil.getOrCreateResourceInternal(ResourceUtil.java:666) [ org.apache.sling.api:2.22.0]
at org.apache.sling.api.resource.ResourceUtil.getOrCreateResource(ResourceUtil.java:603) [ org.apache.sling.api:2.22.0]
at org.apache.sling.api.resource.ResourceUtil.getOrCreateResource(ResourceUtil.java:571) [ org.apache.sling.api:2.22.0]
at org.apache.sling.api.resource.ResourceUtil.getOrCreateResourceInternal(ResourceUtil.java:654) [ org.apache.sling.api:2.22.0]
at org.apache.sling.api.resource.ResourceUtil.getOrCreateResource(ResourceUtil.java:603) [ org.apache.sling.api:2.22.0]
at org.apache.sling.api.resource.ResourceUtil.getOrCreateResource(ResourceUtil.java:571) [ org.apache.sling.api:2.22.0]
at org.apache.sling.api.resource.ResourceUtil.getOrCreateResourceInternal(ResourceUtil.java:654) [ org.apache.sling.api:2.22.0]
at org.apache.sling.api.resource.ResourceUtil.getOrCreateResource(ResourceUtil.java:603) [ org.apache.sling.api:2.22.0]
at org.apache.sling.api.resource.ResourceUtil.getOrCreateResource(ResourceUtil.java:571) [ org.apache.sling.api:2.22.0]
at org.apache.sling.api.resource.ResourceUtil.getOrCreateResourceInternal(ResourceUtil.java:654) [ org.apache.sling.api:2.22.0]
at org.apache.sling.api.resource.ResourceUtil.getOrCreateResource(ResourceUtil.java:603) [ org.apache.sling.api:2.22.0]
at org.apache.sling.api.resource.ResourceUtil.getOrCreateResource(ResourceUtil.java:571) [ org.apache.sling.api:2.22.0]
at org.apache.sling.discovery.commons.providers.util.ResourceHelper.getOrCreateResource(ResourceHelper.java:45) [ org.apache.sling.discovery.commons:1.0.20]
at org.apache.sling.discovery.commons.providers.spi.base.IdMapService.readIdMap(IdMapService.java:302) [ org.apache.sling.discovery.commons:1.0.20]
at org.apache.sling.discovery.commons.providers.spi.base.IdMapService.toSlingId(IdMapService.java:280) [ org.apache.sling.discovery.commons:1.0.20]
at org.apache.sling.discovery.oak.cluster.OakClusterViewService.asClusterView(OakClusterViewService.java:174) [ org.apache.sling.discovery.oak:1.2.22]
at org.apache.sling.discovery.oak.cluster.OakClusterViewService.getLocalClusterView(OakClusterViewService.java:120) [ org.apache.sling.discovery.oak:1.2.22]
at org.apache.sling.discovery.base.commons.BaseDiscoveryService.getTopology(BaseDiscoveryService.java:77) [ org.apache.sling.discovery.base:2.0.8]
at org.apache.sling.discovery.oak.OakDiscoveryService.checkForTopologyChange(OakDiscoveryService.java:660) [ org.apache.sling.discovery.oak:1.2.22]
at org.apache.sling.discovery.oak.pinger.OakViewChecker.discoveryLiteCheck(OakViewChecker.java:217) [ org.apache.sling.discovery.oak:1.2.22]
at org.apache.sling.discovery.oak.pinger.OakViewChecker.access$000(OakViewChecker.java:62) [ org.apache.sling.discovery.oak:1.2.22]
at org.apache.sling.discovery.oak.pinger.OakViewChecker$1.run(OakViewChecker.java:193) [ org.apache.sling.discovery.oak:1.2.22]
at org.apache.sling.discovery.base.commons.PeriodicBackgroundJob.safelyRun(PeriodicBackgroundJob.java:86) [ org.apache.sling.discovery.base:2.0.8]
at org.apache.sling.discovery.base.commons.PeriodicBackgroundJob.run(PeriodicBackgroundJob.java:77) [ org.apache.sling.discovery.base:2.0.8]
at java.base/java.lang.Thread.run(Thread.java:834)

Resolution resolution

The error in the log isn’t related to caching, but they appear when the service user doesn’t have the right permissions for the path /var/discovery either on the Author or on the Publisher.

When verifying the permissions for the /var/discovery path, it was found that on the Stage publisher there was no discovery folder under /var, and there was a lot of missing content as well.

While the /var folder on the Production publisher had more than 20 children, the /varfolder on the Stage publisher only had 2: replication and sling.

The issue was fixed after replicating the /var/structure from Production to Stage and restarting the AEM on Stage Publishers.

recommendation-more-help
3d58f420-19b5-47a0-a122-5c9dab55ec7f