turbo: Writing to cache fails with "provided value is too long when setting link name for"

Verify canary release

  • I verified that the issue exists in the latest Turborepo canary release.

Link to code that reproduces this issue

https://github.com/FredrikAugust/sveltekit-vercel-adapter-turborepo-cache-bug

What package manager are you using / does the bug impact?

pnpm

What operating system are you using?

Mac

Which canary version will you have in your reproduction?

1.11.2

Describe the Bug

When using Turborepos Remote Cache functionality with SvelteKit and the SvelteKit Vercel adapter, the cache is never uploaded to the remote cache as it fails with a warning:

 WARNING  IO error: provided value is too long when setting link name for 

Attaching an image as well as it looks quite unique: Screenshot 2023-12-18 at 17 00 56

There isn’t a lot of information online about this warning, and the only google result I get for the warning message is this mailing thread. The reply reads:

[…] use the E flag for tar, as file names are limited to 100 chars.

This put me on the track of file names being a problem for Turborepo when they exceed 100 characters.[0]

(I’m going to be speaking in context of the repro repository)

So I checked out the two folders we upload to the cache:

  • .svelte-kit
  • .vercel

The .svelte-kit folder doesn’t contain any files with paths over 100, but the .vercel one does.

.vercel/output/functions/fn.func/node_modules/.pnpm/@sveltejs+kit@2.0.2_@sveltejs+vite-plugin-svelte@3.0.1_svelte@4.2.8_vite@5.0.10/node_modules/@sveltejs/kit/src/exports/node/polyfills.js

I suspect the extra long dependency paths are from pnpm.

By removing the Vercel adapter it works as expected.

Expected Behavior

It should allow file paths of preferably an arbitrary length, but at least long enough to support the example and then some:)

To Reproduce

The moving parts that make this reproducible:

  • pnpm
  • SvelteKit (with Vite)
  • SvelteKit Vercel Adapter
  • Turborepo

Clone the repro repository: https://github.com/FredrikAugust/sveltekit-vercel-adapter-turborepo-cache-bug

pnpm i
pnpm dlx turbo run build

You should see the following log messages at the bottom

>   ...Finishing writing to cache...                                                                                                                                                                                                                                                WARNING  IO error: provided value is too long when setting link name for 

Additional context

It appears that someone else had a similar problem here which was fixed in this PR: https://github.com/ostreedev/ostree-rs-ext/pull/165/files.

And from the Rust repository: https://github.com/rust-lang/rust/pull/109577/files

TURBO-1950

About this issue

  • Original URL
  • State: closed
  • Created 6 months ago
  • Reactions: 7
  • Comments: 16 (2 by maintainers)

Most upvoted comments

I’m running into the same issue. I’m using Next.js and pure node projects. I cannot get turbo to log the failing resource with turbo build 2&> error.log.

This is the output:

 WARNING  Failed to check if we can skip restoring outputs for auth#build: GrpcFailure(DeadlineExceeded). Proceeding to check cache
 WARNING  Failed to check if we can skip restoring outputs for auth#build: GrpcFailure(DeadlineExceeded). Proceeding to check cache
 WARNING  IO error: provided value is too long when setting link name for 
 WARNING  IO error: provided value is too long when setting link name for 

Hi all, sorry for the hold up. I believe https://github.com/vercel/turbo/pull/6838 fixes the issue, but it hasn’t made it into a release yet. We’re planning on cutting a canary today and if everything looks good we’ll cut a patch with the fix tomorrow.

Same here, also using PNPM on Windows. Repro:

pnpm dlx create-turbo@latest -e with-vue-nuxt -m pnpm longlink
cd longlink
pnpm build  # works fine
pnpm build  # works fine, yields FULL TURBO as expected
cd apps/docs
pnpm add @nuxt/image

Now enable the nuxt/image module.

diff --git a/apps/docs/nuxt.config.ts b/apps/docs/nuxt.config.ts
index bf4ba7c..b37af13 100644
--- a/apps/docs/nuxt.config.ts
+++ b/apps/docs/nuxt.config.ts
@@ -1,4 +1,7 @@
 // https://nuxt.com/docs/api/configuration/nuxt-config
 export default defineNuxtConfig({
   devtools: { enabled: true },
-});
+  modules: [
+    '@nuxt/image'
+  ]
+})

Then the cache never gets reused again, despite the input having the same hashes.

pnpm build  # results in a full build
pnpm build  # results in a full build again
rm -r apps/docs/.output
pnpm build  # now I get a FULL TURBO

Only sometimes I get the error:

WARNING IO error: provided value is too long when setting link name for apps/docs/.output/server/node_modules/css-tree

@chris-olszewski, I am still seeing the IO error: provided value is too long when setting link name issue when building Next.js 14 app in standalone mode with PNPM on Windows. Is the link name max length something that can be adjusted on the user side, or can the team investigate it further?

I’ve verified that 1.11.3-canary.2 doesn’t run into the issue with symlinks on the provided reproductions. Running a patch release for 1.11.3 now.

Closing as I believe this is addressed, if you encounter the same/similar issue after 1.11.3 please open a new issue.