Skip to content

Contentlets with Relationships breaks block editor #31894

@valentinogiardino

Description

@valentinogiardino

Problem Statement

Contentlets containing a Block Editor field fail to render properly when content with relationships is added inside the block. This causes a Velocity parser exception, and as a result, the Page API does not return the expected rendered attribute, causing the contentlet to be excluded from the page.

issue-block-editor-relationships.mp4

Log:

20:20:35.223  WARN  resource.ResourceManagerImpl - ResourceManager.getResource() parse exception @ url:GET//docs.direct.worldline-solutions.com/api/v1/page/render/design-and-test-tools/test-main-template | lang:1 | ip:172.17.0.1 | Admin:true | start:04-11-2025 08:18:45 GMT  ref:https://local.dotcms.site:8443/dotAdmin/  ?language_id=1&com.dotmarketing.persona.id=modes.persona.no.persona&mode=EDIT_MODE
com.dotcms.rendering.velocity.events.PreviewEditParseErrorException: Encountered "]" at /EDIT_MODE/2f2eed6b0b69f7e47b06f729181277d1_1_DEFAULT.contentlet[line 45, column 25]
Was expecting one of:
    "[" ...
    "{" ...
    <STRING_LITERAL> ...
    "true" ...
    "false" ...
    <INTEGER_LITERAL> ...
    <FLOATING_POINT_LITERAL> ...
    <IDENTIFIER> ...
    "{" ...
    <IDENTIFIER> ...
    "{" ...
    <INTEGER_LITERAL> ...
    "[" ...

        at com.dotcms.rendering.velocity.events.ExceptionHandlerParseErrorException.handle(ExceptionHandlerParseErrorException.java:38) ~[?:?]
        at com.dotcms.rendering.velocity.events.ExceptionHandlerParseErrorException.handle(ExceptionHandlerParseErrorException.java:24) ~[?:?]
        at org.apache.velocity.Template.process(Template.java:163) ~[?:?]
        at org.apache.velocity.runtime.resource.ResourceManagerImpl.loadResource(ResourceManagerImpl.java:454) ~[?:?]
        at org.apache.velocity.runtime.resource.ResourceManagerImpl.getResource(ResourceManagerImpl.java:359) ~[?:?]
        at org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:1510) ~[?:?]
        at com.dotcms.rendering.velocity.directive.DotDirective.loadTemplate(DotDirective.java:51) ~[?:?]
        at com.dotcms.rendering.velocity.directive.DotDirective.render(DotDirective.java:113) ~[?:?]
        at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:214) ~[?:?]
...

Steps to Reproduce

  1. Create a Content Type with a relationship field .

  2. Create a contentlet of that type.

  3. Create a second Content Type with a Block Editor field .

  4. Create a contentlet of this second type, and insert the first contentlet into the block editor.

  5. Place the second contentlet on a page.

Expected: The contentlet renders correctly on the page.

Actual: The contentlet fails to render.

  • The Page API response omits the contentlet's rendered attribute.

  • Backend logs show a Velocity parser exception

Acceptance Criteria

  • Block Editor should support contentlets that include relationship fields.

  • No Velocity exceptions should occur when such contentlets are rendered.

  • The Page API should return the correct rendered output for affected contentlets.

dotCMS Version

dotcms/dotcms:trunk_88f91a3

Proposed Objective

Core Features

Proposed Priority

Priority 2 - Important

External Links... Slack Conversations, Support Tickets, Figma Designs, etc.

https://dotcms.slack.com/archives/C089DJ48C01/p1744303617932489
https://dotcms.freshdesk.com/a/tickets/30478

Assumptions & Initiation Needs

No response

Quality Assurance Notes & Workarounds

No response

Sub-Tasks & Estimates

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions