Some document URLs breaking after resolving with Prismic client routes

Describe your question/issue in detail

Impacted feature

Linked relationship document has broken resolved URL (notice the url key value):

{
    "id": "aIHjYREAAB8ADpKj",
    "type": "page",
    "tags": [redacted],
    "lang": "en-us",
    "slug": [redacted],
    "first_publication_date": "2025-07-24T07:40:52+0000",
    "last_publication_date": "2025-07-24T07:51:20+0000",
    "uid": "lorem-ipsum",
    "url": ">&<00029aH5SrREAACMACQZl%%parent_path>&<00018aH5SrREAACMACQZl%%/lorem-ipsum",
    "link_type": "Document",
    "key": "c24cd137-cd4e-48e5-9e07-94339fd9fc0f",
    "isBroken": false,
    "text": "Learn More"
}

Route definition:

{
  type: 'page',
  lang: 'en-us',
  path: '/:parentpath?/:path?/:uid',
  resolvers: {
    parentpath: 'path.parent_path',
    path: 'path',
  },
},

To get this object (link field), we go through two content relationships: Slice -> Group field (relation 1) -> Group field (relation 2) -> Link.

What's odd is that we already have a footer with page links and those links are not broken. This makes me think the issue may be related to the newest Field Picker in Slice Machine.

What steps have you taken to resolve this issue already?

  • compared with another project of mine where the solution is pretty much the same (the only difference is in the naming – Paths being Page Categories) and it works over there perfectly fine, although I haven't tested it with such deep nesting
  • re-published path documents and page documents for potentially fixing refs in Prismic's database
  • added/removed /:lang? part in the path

Errors

Just a broken link.

Your Role

Frontend developer.

Hosting provider

All happening locally.

Package.json file

{
  "name": [redacted],
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "dev": "concurrently \"npm:next:dev\" \"npm:slicemachine\" --names \"next,slicemachine\" --prefix-colors blue,magenta",
    "next:dev": "next dev",
    "build": "next build",
    "start": "next start",
    "lint": "next lint",
    "lint:fix": "prettier --write . && next lint --fix",
    "slicemachine": "start-slicemachine"
  },
  "dependencies": {
    [redacted],
    "@gsap/react": "^2.1.0",
    "@next/bundle-analyzer": "^15.2.1",
    "@next/third-parties": "^15.1.6",
    "@prismicio/client": "^7.16.1",
    "@prismicio/helpers": "^2.3.9",
    "@prismicio/next": "^1.7.1",
    "@prismicio/react": "^3.2.1",
    [redacted],
    "@tailwindcss/aspect-ratio": "^0.2.1",
    "@tanstack/eslint-plugin-query": "^5.78.0",
    "@tanstack/react-query": "^5.80.6",
    "@typeform/embed-react": "^2.21.0",
    "email-validator": "^2.0.4",
    "embla-carousel-auto-scroll": "^8.6.0",
    "embla-carousel-autoplay": "^8.5.1",
    "embla-carousel-react": "^8.5.1",
    "graphql": "^16.11.0",
    "graphql-request": "^7.2.0",
    "gsap": "^3.12.5",
    "intl-tel-input": "^17.0.13",
    "next": "14.1.4",
    "next-seo": "^6.5.0",
    "react": "^18",
    "react-dom": "^18",
    "react-hook-form": "^7.57.0",
    "react-select": "^3.2.0"
  },
  "devDependencies": {
    "@slicemachine/adapter-next": "^0.3.81",
    "@types/node": "^20",
    "@types/react": "^18",
    "@types/react-dom": "^18",
    "autoprefixer": "^10.0.1",
    "concurrently": "^9.1.2",
    "netlify-cli": "^17.21.1",
    "postcss": "^8",
    "prettier": "^3.1.0",
    "slice-machine-ui": "^2.17.1",
    "tailwindcss": "^3.3.0",
    "typescript": "^5"
  }
}

Steps to reproduce

To get the object with a broken URL (link field), we go through two content relationships: Slice -> Group field (relation 1) -> Group field (relation 2) -> Link.

What's odd is that we already have a footer with page links and those links are not broken. This makes me think the issue may be related to the newest Field Picker in Slice Machine.

Hey @bartosz.holubowicz,

Thanks for the detailed post - I have a couple follow up questions:

  • On the other project you have that's working, are you also using the field picker, just with one level of nesting instead of 2?
  • Same question for your footer, is it also a deeper nesting/done using the field picker?

You may be right that it's this new feature causing trouble, so trying to get more details on your setup to make sure the team has what they need to give it a good look :slight_smile:

Hey @Ezekiel, thanks for the followup!

As for your questions – the other project is also using field picker. All of the working examples I've provided are not using relations, so both for the other project and the current project. I can't currently confirm whether deep relation nesting causes the same issue in the other project, but that's my current hypothesis, as I haven't faced this issue before.

@bartosz.holubowicz got it, thanks! Have you made any recent changes to your project otherwise? Any updates, structural changes, new content? Did those relationship exist before and you're re-building them with the field picker, or is this new?

These relationships for a new slice are new and currently WIP. The most recent change was adding parent_path relation to the Path content type, and that was done with Field Picker already in place.

I might add that even when reverting this most recent change with /:parentpath? addition to the route, the links still appear broken: http://localhost:3000/%3E&%3C00018aH5SrREAACMACQZl%%/lorem-ipsum

Thanks for that! Could you share your type models? The issue might be in your route definitions.

Sure, here you go:

page:

{
  "format": "page",
  "id": "page",
  "label": "Page",
  "repeatable": true,
  "status": true,
  "json": {
    "Main": {
      "uid": {
        "type": "UID",
        "config": {
          "label": "UID",
          "placeholder": ""
        }
      },
      "color_theme": {
        "type": "Select",
        "config": {
          "label": "Color Theme",
          "placeholder": "",
          "options": ["primary", "inverse"],
          "default_value": "primary"
        }
      },
      "footer_variant": {
        "type": "Select",
        "config": {
          "label": "Footer Variant",
          "placeholder": "",
          "options": ["copy", "contact", "slim"],
          "default_value": "copy"
        }
      },
      "path": {
        "type": "Link",
        "config": {
          "label": "Path",
          "select": "document",
          "customtypes": ["path"]
        }
      },
      "hide_navbar": {
        "type": "Boolean",
        "config": {
          "label": "Hide Navbar",
          "placeholder_false": "false",
          "placeholder_true": "true",
          "default_value": false
        }
      },
      "slices": {
        "type": "Slices",
        "fieldset": "Slice Zone",
        "config": {
          "choices": {
            "block_features_static": {
              "type": "SharedSlice"
            },
            "block_call_to_action": {
              "type": "SharedSlice"
            },
            "block_affiliate_form": {
              "type": "SharedSlice"
            },
            "block_spacer": {
              "type": "SharedSlice"
            },
            "block_compare_table": {
              "type": "SharedSlice"
            },
            "block_numbered_features": {
              "type": "SharedSlice"
            },
            "block_our_solutions": {
              "type": "SharedSlice"
            },
            "block_centered_content": {
              "type": "SharedSlice"
            },
            "block_footer_form": {
              "type": "SharedSlice"
            },
            "block_restaurants_marquee": {
              "type": "SharedSlice"
            },
            "block_text_marquee": {
              "type": "SharedSlice"
            },
            "block_links": {
              "type": "SharedSlice"
            },
            "block_link_shapes": {
              "type": "SharedSlice"
            },
            "block_legal_text_v2": {
              "type": "SharedSlice"
            },
            "block_support": {
              "type": "SharedSlice"
            },
            "block_image": {
              "type": "SharedSlice"
            },
            "block_contact": {
              "type": "SharedSlice"
            },
            "block_text_columns": {
              "type": "SharedSlice"
            },
            "block_centered_image": {
              "type": "SharedSlice"
            },
            "block_faq_v2": {
              "type": "SharedSlice"
            },
            "block_locations": {
              "type": "SharedSlice"
            },
            "block_animated_marquee_V2": {
              "type": "SharedSlice"
            },
            "block_facilities_hero": {
              "type": "SharedSlice"
            },
            "block_restaurants_slider": {
              "type": "SharedSlice"
            },
            "block_social_images": {
              "type": "SharedSlice"
            },
            "block_location_slider": {
              "type": "SharedSlice"
            },
            "block_text_image": {
              "type": "SharedSlice"
            },
            "block_customers_slider": {
              "type": "SharedSlice"
            },
            "block_testimonial_slider": {
              "type": "SharedSlice"
            },
            "block_scroll": {
              "type": "SharedSlice"
            },
            "block_heading": {
              "type": "SharedSlice"
            },
            "block_animated_marquee": {
              "type": "SharedSlice"
            },
            "block_legal_text": {
              "type": "SharedSlice"
            },
            "block_header_form": {
              "type": "SharedSlice"
            },
            "block_faq": {
              "type": "SharedSlice"
            },
            "block_features_banner": {
              "type": "SharedSlice"
            },
            "block_footer_cta": {
              "type": "SharedSlice"
            },
            "block_testimonial": {
              "type": "SharedSlice"
            },
            "block_marquee": {
              "type": "SharedSlice"
            },
            "header_image_cta": {
              "type": "SharedSlice"
            }
          }
        }
      }
    },
    "SEO & Metadata": {
      "meta_title": {
        "type": "Text",
        "config": {
          "label": "Meta Title"
        }
      },
      "meta_description": {
        "type": "Text",
        "config": {
          "label": "Meta Description"
        }
      },
      "meta_keywords": {
        "type": "Text",
        "config": {
          "label": "Meta Keywords",
          "placeholder": ""
        }
      },
      "meta_image": {
        "type": "Image",
        "config": {
          "label": "Meta Image",
          "constraint": {
            "width": 2400,
            "height": 1260
          },
          "thumbnails": []
        }
      },
      "no_index": {
        "type": "Boolean",
        "config": {
          "label": "Don't index this page",
          "placeholder_false": "false",
          "placeholder_true": "true",
          "default_value": false
        }
      }
    }
  }
}

path:

{
  "format": "page",
  "id": "path",
  "label": "Path",
  "repeatable": true,
  "status": true,
  "json": {
    "Main": {
      "uid": {
        "type": "UID",
        "config": {
          "label": "UID"
        }
      },
      "parent_path": {
        "type": "Link",
        "config": {
          "label": "Parent Path",
          "select": "document",
          "repeat": false,
          "customtypes": ["path"]
        }
      },
      "slices": {
        "type": "Slices",
        "fieldset": "Slice Zone",
        "config": {
          "choices": {}
        }
      }
    }
  }
}

Please do keep in mind that this same route resolver resolves footer links correctly, while not resolving correctly the double relation nested one.

Hey @bartosz.holubowicz, we're investigating this, and will get back to you once we know more!