nextjs - ✅(Solved) Fix Turbopack "Item already exists" with custom loader [1 pull requests, 1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
vercel/next.js#85833Fetched 2026-04-08 02:13:44
View on GitHub
Comments
1
Participants
2
Timeline
11
Reactions
2
Author
Timeline (top)
referenced ×4labeled ×2closed ×1commented ×1

Error Message

Somehow randomly, at some point this error will be printed: As you can see in the repro, I've added the most basic loader I can imagine. This seems to cause the error somehow.

Fix Action

Fixed

PR fix notes

PR #85858: Turbopack: remove the streaming hack for improved stability

Description (problem / solution / changelog)

What?

Remove the hack we use for streaming in turbo-tasks. We don't use the stream capability and the streaming hack causes some problems.

fixes Item already exists error

Closes https://github.com/vercel/next.js/issues/85833

Changed files

  • crates/next-core/src/next_font/google/mod.rs (modified, +3/-5)
  • turbopack/crates/turbo-tasks-backend/src/backend/mod.rs (modified, +0/-2)
  • turbopack/crates/turbo-tasks-backend/src/backend/operation/update_cell.rs (modified, +2/-5)
  • turbopack/crates/turbopack-node/src/evaluate.rs (modified, +53/-207)
  • turbopack/crates/turbopack-node/src/transforms/postcss.rs (modified, +2/-3)
  • turbopack/crates/turbopack-node/src/transforms/webpack.rs (modified, +5/-23)
  • turbopack/crates/turbopack-tests/tests/execution.rs (modified, +2/-8)

Code Example

thread 'tokio-runtime-worker' (5780103) panicked at /Users/geist/dev/actions-runner/_work/next.js/next.js/turbopack/crates/turbo-tasks-backend/src/backend/operation/update_cell.rs:223:30:
Item already exists
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

---

Operating System:
  Platform: darwin
  Arch: x64
  Version: Darwin Kernel Version 24.6.0: Mon Jul 14 11:28:17 PDT 2025; root:xnu-11417.140.69~1/RELEASE_X86_64
  Available memory (MB): 16384
  Available CPU cores: 12
Binaries:
  Node: 24.4.1
  npm: 11.4.2
  Yarn: 1.22.22
  pnpm: 10.17.1
Relevant Packages:
  next: 16.0.2-canary.7 // Latest available version is detected (16.0.2-canary.7).
  eslint-config-next: N/A
  react: 19.2.0
  react-dom: 19.2.0
  typescript: 5.9.3
Next.js Config:
  output: N/A
RAW_BUFFERClick to expand / collapse

Link to the code that reproduces this issue

https://github.com/amannn/nextjs-bug-repro-turbo-item-exists/commit/c173eb435354d1f57064c4a9c8a07144e2dd9844

To Reproduce

  1. pnpm i && pnpm dev
  2. Make changes to app/page.tsx or app/Client.tsx like adding some text, save, add more text, save, delete some text, save, and repeat in a quick interval (~ 1-2s)

Current vs. Expected behavior

Somehow randomly, at some point this error will be printed:

thread 'tokio-runtime-worker' (5780103) panicked at /Users/geist/dev/actions-runner/_work/next.js/next.js/turbopack/crates/turbo-tasks-backend/src/backend/operation/update_cell.rs:223:30:
Item already exists
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
<img width="2016" height="2414" alt="Image" src="https://github.com/user-attachments/assets/8da61b90-131c-4170-a529-ce089faf9505" />

Provide environment information

Operating System:
  Platform: darwin
  Arch: x64
  Version: Darwin Kernel Version 24.6.0: Mon Jul 14 11:28:17 PDT 2025; root:xnu-11417.140.69~1/RELEASE_X86_64
  Available memory (MB): 16384
  Available CPU cores: 12
Binaries:
  Node: 24.4.1
  npm: 11.4.2
  Yarn: 1.22.22
  pnpm: 10.17.1
Relevant Packages:
  next: 16.0.2-canary.7 // Latest available version is detected (16.0.2-canary.7).
  eslint-config-next: N/A
  react: 19.2.0
  react-dom: 19.2.0
  typescript: 5.9.3
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

Turbopack

Which stage(s) are affected? (Select all that apply)

next dev (local)

Additional context

As you can see in the repro, I've added the most basic loader I can imagine. This seems to cause the error somehow.

extent analysis

TL;DR

The issue can likely be mitigated by adjusting the save interval or implementing a debouncing mechanism when making rapid changes to files like app/page.tsx or app/Client.tsx during next dev.

Guidance

  • Rapid Save Intervals: The error seems to occur when saving changes at very short intervals (~1-2 seconds). Try increasing the time between saves to see if the issue persists.
  • Debouncing: Consider implementing a debouncing mechanism in your development workflow to limit the frequency of saves or updates to the files, potentially reducing the occurrence of the "Item already exists" error.
  • Environment Variable: Running with the RUST_BACKTRACE=1 environment variable might provide more detailed backtrace information, helping to pinpoint the exact cause of the issue.
  • Version Check: Although the latest available version of Next.js is being used, keep an eye on future updates, as this issue might be addressed in subsequent releases.

Example

No specific code example can be provided without altering the original codebase, but a simple debouncing function in JavaScript might look like this:

function debounce(func, wait) {
  let timeout;
  return function(...args) {
    const context = this;
    clearTimeout(timeout);
    timeout = setTimeout(() => func.apply(context, args), wait);
  };
}

This example is a basic illustration and would need adaptation to fit the specific use case.

Notes

The provided information suggests that the issue is related to the rapid saving of changes during development with next dev, possibly triggering a race condition or an issue with how Turbopack handles concurrent updates. The exact cause within the Turbopack codebase or Next.js integration is not specified and would require further investigation.

Recommendation

Apply a workaround, such as debouncing saves or increasing the save interval, as the issue seems closely related to the frequency of file updates rather than a straightforward version fix.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

nextjs - ✅(Solved) Fix Turbopack "Item already exists" with custom loader [1 pull requests, 1 comments, 2 participants]