# Random 404 errors on second level pages

**URL:** <https://community.prismic.io/t/random-404-errors-on-second-level-pages/20096>\
**Category:** Developing with Prismic\
**Tags:** nextjs, link-route-resolver, slice-machine\
**Created:** [January 27, 2026, 7:56pm UTC](https://community.prismic.io/t/random-404-errors-on-second-level-pages/20096 "2026-01-27T19:56:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Fiskbulle](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/fiskbulle/32/8436_2.png) [@Fiskbulle](https://community.prismic.io/u/Fiskbulle)\
**Post date:** [January 27, 2026, 7:56pm UTC](https://community.prismic.io/t/random-404-errors-on-second-level-pages/20096/1 "2026-01-27T19:56:11Z")

</div>

## I suddenly started to get 404 errors on second level pages

I'm not sure what happened or when it happened because everything has been working fine during the development of my website, but when I had to run my build command on my server on a Digitalocean droplet, I started getting 404 errors on second-level pages under app/:uid.

I then ran the build command on my localhost and development environment to understand what the problem may have been, but now I also get the same errors on my localhost. General page and slice templates are error free. I went over them all before I felt ready to move my project to a server, so I suspect something happened with my Route Resolver objects.

My project is based on Next.js and Tailwind, and this is my **prismicio.ts** file. It contains my Route Resolver objects.

```auto
/**
 * prismicio.ts
 * 
 */

import * as prismic from '@prismicio/client'
import * as prismicNext from '@prismicio/next'
import config from '../slicemachine.config.json'

/**
 * The project's Prismic repository name.
 */

export const repositoryName = process.env.NEXT_PUBLIC_PRISMIC_ENVIRONMENT || config.repositoryName

/**
 * A list of Route Resolver objects that define how a document's `url` field is resolved.
 *
 * {@link https://prismic.io/docs/route-resolver#route-resolver}
 */

const routes: prismic.ClientConfig["routes"] = [
	{
		type: "home",
		path: "/",
	},
	{
		type: "page",
		path: "/:uid",
	},
	{
		type: "article",
		path: "/:uid",
	},
	{
		type: "showcase",
		path: "/work/:uid",
	}
]

/**
 * Creates a Prismic client for the project's repository. The client is used to
 * query content from the Prismic API.
 *
 * @param config - Configuration for the Prismic client.
 */

export const createClient = (config: prismicNext.CreateClientConfig = {}) => {

	const client = prismic.createClient(repositoryName, {
		routes,
		fetchOptions:
			process.env.NODE_ENV === "production"
			? { next: { tags: ["prismic"] }, cache: "force-cache" }
			: { next: { revalidate: 5 } },
		...config,
	})

	prismicNext.enableAutoPreviews({
		client,
		previewData: config.previewData,
		req: config.req,
	})

	return client
}

```

I also added middleware because I wanted to use multiple languages but load correct language based on domain name. This is my **middleware,ts** file.

```auto
/**
 * middleware.ts
 * 
 */

import { NextResponse } from 'next/server'
import type { NextRequest } from 'next/server'

/**
 * Listening to header requests, and can be marked 'async' if using 'await' inside
 * 
 */

export function middleware(request: NextRequest) {

    const requestHeaders = new Headers(request.headers)
    const host = request.nextUrl.host

    let locale = 'en-us'

    if (host.endsWith('company.de')) {
        
        locale = 'de-de';
    }
    
    requestHeaders.set('x-next-pathname', request.nextUrl.pathname)
    requestHeaders.set('x-locale', locale)
    
    return NextResponse.next({
        
        request: {
            
            headers: requestHeaders,
        },
    })
}

/**
 * Fetches and export matching paths
 */

export const config = {

    matcher: ['/((?!api|_next/static|_next/image|favicon.ico).*)',],
}

```

What I did notice is that the next file _app-build-manifest.json_ clearly changed after the build command, and I can clearly see that pages on second level (/[uid]/page) is missing in that new manifest.

**Old manifest**

```auto
{
  "pages": {
    "/page": [
      "static/chunks/webpack.js",
      "static/chunks/main-app.js",
      "static/chunks/app/page.js"
    ],
    "/layout": [
      "static/chunks/webpack.js",
      "static/chunks/main-app.js",
      "static/css/app/layout.css",
      "static/chunks/app/layout.js"
    ],
    "/loading": [
      "static/chunks/webpack.js",
      "static/chunks/main-app.js",
      "static/chunks/app/loading.js"
    ],
    "/not-found": [
      "static/chunks/webpack.js",
      "static/chunks/main-app.js",
      "static/chunks/app/not-found.js"
    ],
    "/[uid]/page": [
      "static/chunks/webpack.js",
      "static/chunks/main-app.js",
      "static/chunks/app/[uid]/page.js"
    ],
    "/work/[uid]/page": [
      "static/chunks/webpack.js",
      "static/chunks/main-app.js",
      "static/chunks/app/work/[uid]/page.js"
    ]
  }
}

```

**New manifest**

```auto
{
  "pages": {
    "/page": [
      "static/chunks/webpack.js",
      "static/chunks/main-app.js",
      "static/chunks/app/page.js"
    ],
    "/layout": [
      "static/chunks/webpack.js",
      "static/chunks/main-app.js",
      "static/css/app/layout.css",
      "static/chunks/app/layout.js"
    ],
    "/loading": [
      "static/chunks/webpack.js",
      "static/chunks/main-app.js",
      "static/chunks/app/loading.js"
    ],
    "/not-found": [
      "static/chunks/webpack.js",
      "static/chunks/main-app.js",
      "static/chunks/app/not-found.js"
    ],
    "/work/[uid]/page": [
      "static/chunks/webpack.js",
      "static/chunks/main-app.js",
      "static/chunks/app/work/[uid]/page.js"
    ],
    "/_not-found/page": [
      "static/chunks/webpack.js",
      "static/chunks/main-app.js",
      "static/chunks/app/_not-found/page.js"
    ]
  }
}

```

The whole project is located under a /src/ folder as it was suggested in a prismic starter kit. Below is the file structure and if I understand the error I can see in the manifest, then next can’t find the /[uid]/page.

```auto
src/
└── app/
    ├── [uid]/
    │ └── Page.tsx
    ├── api/
    ├── slicesimulator/
    ├── work/
    │ └── [uid]/
    │ └── page.tsx
    ├── Footer.tsx
    ├── Header.tsx
    ├── layout.tsx
    ├── loading.tsx
    ├── not-found.tsx
    └── page.tsx

```

I first thought it was related to Eslint which I had to updated on my server, but I suspect that is not the case, and I know that it all worked fine on the following setup.

```auto
├── eslint-config-next@14.2.35
├── eslint@8.57.0
├── next@14.2.35

```

If anyone can see a clear error in what is shared, please suggest what I can do differently.

---

<div class="post-metadata">

**Author:** ![Ezekiel](https://avatars.discourse-cdn.com/v4/letter/e/848f3c/32.png) [@Ezekiel](https://community.prismic.io/u/Ezekiel)\
**Post date:** [January 28, 2026, 11:40am UTC](https://community.prismic.io/t/random-404-errors-on-second-level-pages/20096/2 "2026-01-28T11:40:32Z")

</div>

Hey @Fiskbulle,

Thanks for all the details, that's really helpful to troubleshoot! Throwing it out there before digging deeper, could you make sure your `Page.tsx` under `app/[uid]` is written as `page.tsx`, and see if that fixes the issue? It might be just that 🙂

---

<div class="post-metadata">

**Author:** ![Fiskbulle](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/fiskbulle/32/8436_2.png) [@Fiskbulle](https://community.prismic.io/u/Fiskbulle)\
**Post date:** [January 28, 2026, 12:11pm UTC](https://community.prismic.io/t/random-404-errors-on-second-level-pages/20096/3 "2026-01-28T12:11:04Z")

</div>

Thanks @Ezekiel for the quick response.

I noticed the same problem when I finally posted everything and was able to quickly see the big picture. The capitalization of the file was the problem here and after changing that, everything worked as intended again.

Cheers 🙂
