Multiple Locales Error page

HI there,

I'm developing a website in English and Spanish, and I'm having trouble displaying a custom error page.

English is the default language and resolves without locale codes in the URL. eg /page/

I can correctly get the error page to display at both /en-us/fdfd and /es-ar/fdfd, but if I just visit /fdfd then it doe snot display and I get an error: 'Cannot read properties of undefined (reading 'data')'

I'm using a link-resolver as follows:

export default function (doc) {
  if (doc.type === "home") {
    return `/${doc.lang}`;

  if (doc.type === "page") {
    return `/${doc.lang}/${doc.uid}`;

  if (doc.type === "preview") {
    return "/preview" + doc.uid;
  if (doc.isBroken) {
    return "/error";

  return "/";

And in my nuxt.config

  generate: {
    fallback: "404.html",

The actual error page is as follows, error,vue

  <div class="page page-error">
    <prismic-rich-text :field="errorMessage" v-if="errorMessage" />
    <div class="error-images">
          errorImage?.dimensions?.width / errorImage?.dimensions.height
          errorImageSmall?.dimensions?.width /


export default {
  data() {
    return {
      errorMessage: null,
      errorImage: null,
      errorImageSmall: null,
  async mounted() {
    try {
      const language = this.$route.params.lang;
      const global = await this.$prismic.api.getSingle("global", {
        lang: language,
      this.errorMessage =;
      this.errorImage =;
      this.errorImageSmall =;
    } catch (err) {
      console.error("Failed to fetch data: ", err);

How do I get the error page working for the default locale without the locale code in the URL?

Hi @grafik ,

I'll try my best to help :slight_smile:

Can you add some logs in your components to better understand when the issue happens?