Broken type on Prismic Builder

Hello everyone!

I'm having a small problem or maybe I'm doing something wrong with a slice component

When my slice is rendered locally I get the "item" relationship correctly populated but in the builder (xx.prismic.io) I get a broken_type

I was expecting to be able to retrieve the relationships and potentially use them in the slice to properly manage the component preview.

I've already tried to :

  • archive / publish relationship documents
  • link another document type
  • recreate a slice with relationships and I get the same error.

I'm still learning Prismic, so I might make a mistake.

Errors

Returning data when fetching XX.prismic.io :

[
	{
	    item: {
	      key: 'c0f4e883-2a1b-4c9c-9600-9000b517e179',
	      id: 'Z6OnJBEAACsACyOO',
	      tags: [],
	      type: 'broken_type',
	      isBroken: true
    }
]

VS :
Returning data when fetching locally :

[
    {
	    item: {
	      id: 'Z6OnJBEAACsACyOO',
	      type: 'products',
	      tags: [],
	      lang: 'fr-fr',
	      slug: 'brighton-insulated-snow-jacket',
	      first_publication_date: '2025-02-05T18:00:11+0000',
	      last_publication_date: '2025-02-12T10:52:51+0000',
	      uid: 'brighton-insulated-snow-jacket',
	      url: '/products/brighton-insulated-snow-jacket',
	      link_type: 'Document',
	      key: 'cd31dead-9c3c-4574-944a-73d642dcb55a',
	      isBroken: false
    }
]

Hosting provider

  • Local / Production Repository on Prismic (with only one master ref)

Package.json file

"@prismicio/client": "^7.15.1",
"@prismicio/next": "^1.7.1",
"@prismicio/react": "^2.9.1",
--
"@slicemachine/adapter-next": "^0.3.66",
"slice-machine-ui": "^2.12.3",

Steps to reproduce

  • Create a slice with relationship
  • Add document in the relation slot
  • Console log slice.primary.[relation key]

I think the builder flags relationships as broken types when it can’t retrieve the linked document, like if the document is unpublished since it can’t recover missing or unpublished relationships.

Try publishing or re-saving the related document.

Hi Pau, thank you for your reply !

I was thinking about that too, I tried it and it makes no difference. I even tried recreating a complete slice.

What's strange is that it works perfectly outside builder

Hi Henri,

Thanks for reaching out! We’re not entirely sure what’s causing this issue yet, and we’d love to get a clearer picture of what’s happening on your end.

Would you be able to record a short screen capture using Jam.dev to show the issue in action? Specifically, it would be helpful to see:
• How the content relationship is set up in your slice.
• How it appears locally vs. in the Prismic builder.
• Any errors or unexpected behavior in the console or network tab.

Once we have more details, we’ll be able to dig deeper and find a solution. Looking forward to your update!

Hi Phil !

Here is the video record : Jam

First time with Jam haha !

Hope this will help :)

1 Like

Thanks Henri,

Yeah, I love Jam.

The video clearly shows that you haven't updated the placeholder text to be replaced by the code for the group field. Slice Machine will give you suggested code snippets to add here; make sure you add this code to your Slice file.

Thanks.

Hi Phil!

Thank you for your answer!

I'm not sure I understand what you mean. In both cases I was simply logging slice.primary.items.

Maybe I need to include the slice machine snippet code, to make the builder work? But if that's the case, why does it work without any additions in the non-builder version?

You will need to paste that snippet code into the Slices code, replacing the placeholder text.

Oh okay but the problem is not here

The problem is when i log the slice.primary.items in the builder the type is "broken_type" and in local it's the correct document type ref

Hi @henri.fardeau,

I see what you mean! I'm not immediately sure what's causing this, but can you elaborate on what you're trying to do in the builder that's not working as a result? I'm trying to understand what you're attempting so we know where to go next. What is this broken_type error preventing you from doing specifically, since it's working on local?

I hope my question makes sense :slight_smile:

Hello Ezekiel,

Thank you for your answer :slight_smile:

To give some context, I'm working on an ecommerce project. The idea was to create a grid slice that could hold Product and/or Collection items (each of them being a separate document with different fields).

Locally, no problem, I can fetch the prismic refs (via getAllByUIDs) and display my item in either collection or product mode, depending on the document type.

However, I lose the ability to display items in the builder preview because of the broken type (which prevents me from knowing whether the id is a Collection id or a Product id).

Hope this would help

Hi @henri.fardeau,

So I believe it's not possible yet to simulate/preview content relationships. Locally, you're likely looking at live content, so it works without a hitch. When you're trying to display your items in the builder preview, however, we don't support content relationship fields in the same way. This is being tracked as a feature improvement, so the team is aware of the need and intends to implement this though it isn't an immediate priority so I don't have a timeline for you or a more precise ETA.

Sorry about this, but hope you can workaround this with your local server :slight_smile:

1 Like

Hi Ezekiel,

No problem i switch to a different implementation

Thank you for your feedback!

1 Like