"Invalid name" when using node.orderBefore
I'm attempting to pull a property out of an existing node and use it to create a new titlecore node just before the source node and I'm having an issue with moving the newly-created nodes around within a container, it's throwing an IllegalArgumentException saying that the srcChildRelPath has an invalid name. The code executing is
Property globalTitle = ref.getProperty( "title" );
if ( globalTitle != null ) {
Property size = ref.getProperty( "headingStyle" );
Node globalTitleNode = createTitle( session, container, hash, globalTitle.getValue().toString(), size != null ? size.getValue().toString() : null );
container.orderBefore( globalTitleNode.getPath(), ref.getPath() );
}
with the container.orderBefore line being the one that throws the exception. I know the createTitle method returns a valid node, I have the session save in that method and I see the node created as a child of container in CRX/DE. I get the same results if I manually regrab the titlecore node from container before using orderBefore.
The exception I get is
10.01.2024 14:06:44.191 *ERROR* [[0:0:0:0:0:0:0:1] [1704913574756] GET [execution-path] HTTP/1.1] [project-file-path] Invalid name: [page-path]/jcr:content/root/responsivegrid/titlecore_2093688976
java.lang.IllegalArgumentException: Invalid name: [page-path]/jcr:content/root/responsivegrid/titlecore_2093688976
at org.apache.jackrabbit.oak.spi.state.AbstractNodeState.checkValidName(AbstractNodeState.java:62) [org.apache.jackrabbit.oak-store-spi:1.22.15]
at org.apache.jackrabbit.oak.plugins.memory.MemoryNodeBuilder.getChildNode(MemoryNodeBuilder.java:329) [org.apache.jackrabbit.oak-store-spi:1.22.15]
at org.apache.jackrabbit.oak.core.SecureNodeBuilder.<init>(SecureNodeBuilder.java:111) [org.apache.jackrabbit.oak-core:1.22.15]
at org.apache.jackrabbit.oak.core.SecureNodeBuilder.getChildNode(SecureNodeBuilder.java:328) [org.apache.jackrabbit.oak-core:1.22.15]
at org.apache.jackrabbit.oak.core.MutableTree.createChild(MutableTree.java:91) [org.apache.jackrabbit.oak-core:1.22.15]
at org.apache.jackrabbit.oak.core.MutableTree.createChild(MutableTree.java:35) [org.apache.jackrabbit.oak-core:1.22.15]
at org.apache.jackrabbit.oak.plugins.tree.impl.AbstractTree.getChild(AbstractTree.java:240) [org.apache.jackrabbit.oak-core:1.22.15]
at org.apache.jackrabbit.oak.core.MutableTree.getChild(MutableTree.java:159) [org.apache.jackrabbit.oak-core:1.22.15]
at org.apache.jackrabbit.oak.jcr.delegate.NodeDelegate.orderBefore(NodeDelegate.java:374) [org.apache.jackrabbit.oak-jcr:1.22.15]
at org.apache.jackrabbit.oak.jcr.session.NodeImpl$6.performVoid(NodeImpl.java:346) [org.apache.jackrabbit.oak-jcr:1.22.15]
at org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate.performVoid(SessionDelegate.java:273) [org.apache.jackrabbit.oak-jcr:1.22.15]
at org.apache.jackrabbit.oak.jcr.session.NodeImpl.orderBefore(NodeImpl.java:337) [org.apache.jackrabbit.oak-jcr:1.22.15]
at [project-file-path].[method-name]([project-file].java:122) [project-package]
I can't find any documentation on exactly what qualifies as valid JCR node names, but this name is exactly in line with AEM-generated nodes for titlecore if authored normally. I've also copied the full path directly from the exception and pasted it in CRX/DE and it correctly points directly to the node in question. No other logs are giving me any additional information that would point me towards a solution that I've found.

