Export encountered errors on following paths
Answered
Skipjack tuna posted this in #help-forum
Skipjack tunaOP
When using a catch-all segment route with Next.js 14 App Router and generateStaticParams:
Structure:
catch-all
- [id]
- [...title]
page.tsx
During the Next.js build process, an error occurs with the following message:
Export encountered errors on the following paths.
[31m> Export encountered errors on following paths:
/[locale]/catch-all/[id]/[[...title]]/page: /en/catch-all/test-id-1/%EC%95%84%EB%AC%B4%EB%9F%B0-%EC%9D%98%EB%AF%B8%EA%B0%80-%EC%97%86%EB%8A%94-%EB%AC%B4%EC%9E%91%EC%9C%84-%ED%85%8D%EC%8A%A4%ED%8A%B8-%EC%9E%85%EB%A0%A5%EC%9D%84-%EC%97%AC%EA%B8%B0%EC%97%90-%EC%9E%91%EC%84%B1%ED%95%A9%EB%8B%88%EB%8B%A4
This error does not happen for all paths but only for some paths with long encoded non-ASCII characters. For example, the path length after encoding is approximately 320 characters, and the error arises in such cases.
Could this issue be related to a length limit in Next.js?
Or Something wrong?
Structure:
catch-all
- [id]
- [...title]
page.tsx
During the Next.js build process, an error occurs with the following message:
Export encountered errors on the following paths.
[31m> Export encountered errors on following paths:
/[locale]/catch-all/[id]/[[...title]]/page: /en/catch-all/test-id-1/%EC%95%84%EB%AC%B4%EB%9F%B0-%EC%9D%98%EB%AF%B8%EA%B0%80-%EC%97%86%EB%8A%94-%EB%AC%B4%EC%9E%91%EC%9C%84-%ED%85%8D%EC%8A%A4%ED%8A%B8-%EC%9E%85%EB%A0%A5%EC%9D%84-%EC%97%AC%EA%B8%B0%EC%97%90-%EC%9E%91%EC%84%B1%ED%95%A9%EB%8B%88%EB%8B%A4
This error does not happen for all paths but only for some paths with long encoded non-ASCII characters. For example, the path length after encoding is approximately 320 characters, and the error arises in such cases.
Could this issue be related to a length limit in Next.js?
Or Something wrong?
Answered by joulev
so yeah, because it is a nextjs bug, now you either use a very short title or (recommended) just use romanised characters for the slug
29 Replies
before that error message, there should be more error messages which hopefully details what's wrong in more details
Skipjack tunaOP
@joulev
There are no additional logs prior to this issue.
Based on our investigation so far:
The build succeeds or fails depending on the number of characters.
For Korean text, the build succeeds up to 33 characters,
but fails when it exceeds around 35 characters.
Total path size:
269 bytes → Fails
242 bytes → Succeeds
It appears that the build fails when the total path size exceeds approximately 250 bytes.
There are no additional logs prior to this issue.
Based on our investigation so far:
The build succeeds or fails depending on the number of characters.
For Korean text, the build succeeds up to 33 characters,
but fails when it exceeds around 35 characters.
Total path size:
269 bytes → Fails
242 bytes → Succeeds
It appears that the build fails when the total path size exceeds approximately 250 bytes.
well yes but this is not the error message. give me the error message, which should come in the log, above the "Export encountered errors on the following paths." thing
Skipjack tunaOP
[31m[39m
[31m> Export encountered errors on following paths:
/[locale]/catch-all/[id]/[[...title]]/page: /en/catch-all/test-id-1/%EA%B3%A0%EC%B8%B5-%EB%B9%8C%EB%94%A9%EA%B3%BC-%EA%B4%91%EC%95%88%EB%8C%80%EA%B5%90%EA%B0%80-%EB%B3%B4%EC%9D%B4%EB%8A%94-%EB%B2%88%EC%9E%A1%ED%95%9C-%ED%95%AD%EA%B5%AC-%EB%8F%84%EC%8B%9C-%EB%B6%80%EC%82%B0%EC%9D%98-%ED%99%80%EB%A6%AC-%EC%9D%B8%EC%BD%94%EB%94%A9
/[locale]/catch-all/[id]/[[...title]]/page: /en/catch-all/test-id-2/%EA%B3%A0%EC%B8%B5-%EB%B9%8C%EB%94%A9%EA%B3%BC-%EA%B4%91%EC%95%88%EB%8C%80%EA%B5%90%EA%B0%80-%EB%B3%B4%EC%9D%B4%EB%8A%94-%EB%B2%88%EC%9E%A1%ED%95%9C-%ED%95%AD%EA%B5%AC-%EB%8F%84%EC%8B%9C-%EB%B6%80%EC%82%B0%EC%9D%98-%ED%99%80%EB%A6%AC-%EC%9D%B8%EC%BD%94%EB%94%A9
/[locale]/catch-all/[id]/[[...title]]/page: /ko/catch-all/test-id-1/%EA%B3%A0%EC%B8%B5-%EB%B9%8C%EB%94%A9%EA%B3%BC-%EA%B4%91%EC%95%88%EB%8C%80%EA%B5%90%EA%B0%80-%EB%B3%B4%EC%9D%B4%EB%8A%94-%EB%B2%88%EC%9E%A1%ED%95%9C-%ED%95%AD%EA%B5%AC-%EB%8F%84%EC%8B%9C-%EB%B6%80%EC%82%B0%EC%9D%98-%ED%99%80%EB%A6%AC-%EC%9D%B8%EC%BD%94%EB%94%A9
/[locale]/catch-all/[id]/[[...title]]/page: /ko/catch-all/test-id-2/%EA%B3%A0%EC%B8%B5-%EB%B9%8C%EB%94%A9%EA%B3%BC-%EA%B4%91%EC%95%88%EB%8C%80%EA%B5%90%EA%B0%80-%EB%B3%B4%EC%9D%B4%EB%8A%94-%EB%B2%88%EC%9E%A1%ED%95%9C-%ED%95%AD%EA%B5%AC-%EB%8F%84%EC%8B%9C-%EB%B6%80%EC%82%B0%EC%9D%98-%ED%99%80%EB%A6%AC-%EC%9D%B8%EC%BD%94%EB%94%A9
[?25h[41m[30m ELIFECYCLE [39m[49m [31mCommand failed with exit code 1.[39m
and If the byte size does not exceed the limit, no error occurs.
no i meant the error above that part.
in this screenshot i have a sample log, you already gave me the red box part but i'll need to see the green box part to know what's going on
in this screenshot i have a sample log, you already gave me the red box part but i'll need to see the green box part to know what's going on
Skipjack tunaOP
i SEE
Error occurred prerendering page "/en/catch-all/test-id-2/%EA%B3%A0%EC%B8%B5-%EB%B9%8C%EB%94%A9%EA%B3%BC-%EA%B4%91%EC%95%88%EB%8C%80%EA%B5%90%EA%B0%80-%EB%B3%B4%EC%9D%B4%EB%8A%94-%EB%B2%88%EC%9E%A1%ED%95%9C-%ED%95%AD%EA%B5%AC-%EB%8F%84%EC%8B%9C-%EB%B6%80%EC%82%B0%EC%9D%98-%ED%99%80%EB%A6%AC-%EC%9D%B8%EC%BD%94%EB%94%A9". Read more: https://nextjs.org/docs/messages/prerender-error
Error: ENAMETOOLONG: name too long, open '/.next/server/app/en/catch-all/test-id-2/%EA%B3%A0%EC%B8%B5-%EB%B9%8C%EB%94%A9%EA%B3%BC-%EA%B4%91%EC%95%88%EB%8C%80%EA%B5%90%EA%B0%80-%EB%B3%B4%EC%9D%B4%EB%*8A*%94-%EB%B2%88%EC%9E%A1%ED%95%9C-%ED%95%AD%EA%B5%AC-%EB%8F%84%EC%8B%9C-%EB%B6%80%EC%82%B0%EC%9D%98-%ED%99%80%EB%A6%AC-%EC%9D%B8%EC%BD%94%EB%94%A9.rsc'
at async open (node:internal/fs/promises:639:25)
at async Object.writeFile (node:internal/fs/promises:1212:14)
at async baseFileWriter (/node_modules/.pnpm/next@14.2.3_@babel+core@7.24.5_@opentelemetry+api@1.9.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/export/worker.js:226:9)
at async exportAppPage (/node_modules/.pnpm/next@14.2.3_@babel+core@7.24.5_@opentelemetry+api@1.9.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/export/routes/app-page.js:76:13)
at async exportPageImpl (/node_modules/.pnpm/next@14.2.3_@babel+core@7.24.5_@opentelemetry+api@1.9.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/export/worker.js:203:20)
at async Span.traceAsyncFn (/node_modules/.pnpm/next@14.2.3_@babel+core@7.24.5_@opentelemetry+api@1.9.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/trace/trace.js:154:20)
at async Object.exportPage (/node_modules/.pnpm/next@14.2.3_@babel+core@7.24.5_@opentelemetry+api@1.9.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/export/worker.js:236:20)
Skipjack tunaOP
It's Same Issue? https://github.com/vercel/next.js/issues/24159
yeah looks like this is the exact issue you are facing
Skipjack tunaOP
hmmm Its not next.js issue...
have idea to handle it?
have idea to handle it?
i think you don't have to convert the (presumably) korean text to uri encoding. i use this which works fine (i only know japanese so japanese it is)
export function generateStaticParams() {
return [{ slug: "こんにちは" }];
}
converting こんにちは to URI encoding would become %E3%81%93%E3%82%93%E3%81%AB%E3%81%A1%E3%81%AF which is really long, but こんにちは already works well
so no need to convert
Skipjack tunaOP
yeap but if didnt encoding,
when using server action redirect in Vercel depoly
getting error non asicii error
when using server action redirect in Vercel depoly
getting error non asicii error
oh i think i see what you mean...
let me check a little bit
Skipjack tunaOP
ok 🙂 i will make it
this is a bug in nextjs, i suggest you open a bug report.
for now i think you should set up a slug system separate from the titles, with the slugs only containing latin characters. like in the image, if the title is the top then the slug should be the bottom or something similar
for now i think you should set up a slug system separate from the titles, with the slugs only containing latin characters. like in the image, if the title is the top then the slug should be the bottom or something similar
then the URL will not be too long and still be readable (so SEO friendly), and will also not reach the file name length limit
Skipjack tunaOP
here playground https://github.com/FrontLeejonghun/next-app-router-playground
only not work in vercel isr build,
in localy can do anything
in localy can do anything
yeah, uh, since this is just a playground, maybe just choose a short title and you should be good to go. with this long title it won't work due to this nextjs bug where it can't handle non-ascii characters.
when you build an actual app, instead of
when you build an actual app, instead of
yourdomain.com/한글-타이틀-길게-길게-길게아주길게아주아주길게아주길게-인코딩
aim for an URL like yourdomain.com/hangeul-taiteul-...
Skipjack tunaOP
yes But if too short bug cannot be reproduced
indeed, this is a nextjs bug not your bug and you can't do much about it right now
Skipjack tunaOP
i see,
i will report in bugh
i will report in bugh
so yeah, because it is a nextjs bug, now you either use a very short title or (recommended) just use romanised characters for the slug
Answer
Skipjack tunaOP