Next.js Discord

Discord Forum

Error: Failed to collect page data for /_not-found

Unanswered
American posted this in #help-forum
Open in Discord
AmericanOP
Hello

When building my app I get this error:

   Collecting page data ...
TypeError: Invalid URL
    at new URL (node:internal/url:775:36)
    at 35618 (/app/apps/nextjs/.next/server/chunks/2454.js:1:2886)
    at Function.t (/app/apps/nextjs/.next/server/webpack-runtime.js:1:143)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async collectGenerateParams (/app/node_modules/.pnpm/next@14.1.0_@babel+core@7.23.6_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/build/utils.js:919:21)
    at async /app/node_modules/.pnpm/next@14.1.0_@babel+core@7.23.6_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/build/utils.js:1138:17
    at async Span.traceAsyncFn (/app/node_modules/.pnpm/next@14.1.0_@babel+core@7.23.6_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/trace/trace.js:151:20) {
  code: 'ERR_INVALID_URL',
  input: ''
}
> Build error occurred
Error: Failed to collect page data for /_not-found
    at /app/node_modules/.pnpm/next@14.1.0_@babel+core@7.23.6_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/build/utils.js:1258:15
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  type: 'Error'
}
 ELIFECYCLE  Command failed with exit code 1.
ERROR: command finished with error: command (/app/apps/nextjs) /usr/local/bin/pnpm run build exited (1)
command (/app/apps/nextjs) /usr/local/bin/pnpm run build exited (1)


But I don't have a not found-page. I tried creating a basic one but that didn't change anything. Is there a way to print the URL in question so I can debug it?

5 Replies

/_not-found should be the default one. You tried to create app/not-found.tsx and it still fails to build?
AmericanOP
Hey Ray. Yes exactly, I created app/not-found.tsx and the error still references /_not-found just like above
I see now it's only via Docker, so it's maybe not a NextJS problem. Sorry
AmericanOP
Yeah, when I just ran next build locally it worked