question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Very long path names cause ENAMETOOLONG errors when we try to write out their page data

See original GitHub issue

Most file systems / OSs restrict the length of file names cause computers used to be weak sauce.

https://serverfault.com/questions/9546/filename-length-limits-on-linux/9548#9548

Generally to 255 bytes.

An obscure error someone can run into is they’ll create paths longer than this and when we try to write out the page’s page data, Node will crash with a mysterious ENAMETOOLONG.

We should just detect when a path is too long & shorten it within the limits.

We can use a simple algorithm that trims back the path name & hashes the trimmed off parts to preserve uniqueness.

To see a real-world example of this happening & an example algorithm go to https://github.com/gatsbyjs/gatsby/issues/20338#issuecomment-575930958

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:10 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
KyleAMathewscommented, Feb 6, 2020

Or you probably suggest that Gatsby will save the page data to a valid path and map it internally with the right page?

yes, that 😃

0reactions
jlkiricommented, Jun 25, 2020

Should be fixed by #21518. We probably should close this?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Strapi >>> Facing "ENAMETOOLONG: name too long" error
Your example filename looks exactly 255 bytes, but you have a "fancy quote" in there. ... The error is entirely correct: name too...
Read more >
NodeJS create Raster with DataURL - name too long error
Tried to open a new Issue with this but GitHub just reloads the same new issue page when I ... Error: ENAMETOOLONG, name...
Read more >
Contributing to Gatsby - Issue #20699 | Writing - Kirill Vasiltsov
First of all, here's the issue that is the topic of this post. It describes a possible build error when directories/filenames built by...
Read more >
Destination Path Too Long Fix (when Moving/Copying a File)
The file name (s) would be too long for the destination folder. You can shorten the file name and try again, or try...
Read more >
gleam/erlang/file - gleam_erlang
Inappropriate file type or format. Usually caused by trying to set the “sticky bit” on a regular file (not a directory). Eintr.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found