nextjs - 💡(How to fix) Fix Turbopack: Build error when importing Turborepo monorepo package dependency which uses `next/dynamic` into meta files (`robots.ts`, `sitemap.ts`) [2 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#83950Fetched 2026-04-08 02:21:01
View on GitHub
Comments
2
Participants
2
Timeline
10
Reactions
0
Timeline (top)
labeled ×3commented ×2renamed ×2closed ×1

Error Message

next build --turbopack

▲ Next.js 15.5.0 (Turbopack)

Creating an optimized production build ...

thread 'tokio-runtime-worker' panicked at crates/next-api/src/dynamic_imports.rs:70:26: called Option::unwrap() on a None value note: run with RUST_BACKTRACE=1 environment variable to display a backtrace


FATAL: An unexpected Turbopack error occurred. A panic log has been written to /var/folders/vh/r5pbsmwn4f37ch9153sj297w000 0gn/T/next-panic-429073751881a9b45a867bcd3c5143c5.log.

To help make Turbopack better, report this error by clicking here.

Build error occurred Error [TurbopackInternalError]: Failed to write app endpoint /robots.txt/route

Caused by:

  • called Option::unwrap() on a None value

Debug info:

  • Execution of TaskId { id: 2147483650 } transient failed
  • Execution of get_all_written_entrypoints_with_issues_operation failed
  • Execution of EntrypointsOperation::new failed
  • Execution of all_entrypoints_write_to_disk_operation failed
  • Execution of Project::emit_all_output_assets failed
  • Execution of *emit_assets failed
  • Execution of all_assets_from_entries_operation failed
  • Execution of *all_assets_from_entries failed
  • Execution of output_assets_operation failed
  • Execution of <AppEndpoint as Endpoint>::output failed
  • Failed to write app endpoint /robots.txt/route
  • Execution of AppEndpoint::output failed
  • called Option::unwrap() on a None value at <unknown> (TurbopackInternalError: Failed to write app endpoint /robots.txt/route) { type: 'TurbopackInternalError', location: 'crates/next-api/src/dynamic_imports.rs:70:26' }

Root Cause

Caused by:

  • called Option::unwrap() on a None value

Code Example

> next build --turbopack

Next.js 15.5.0 (Turbopack)

   Creating an optimized production build ...

thread 'tokio-runtime-worker' panicked at crates/next-api/src/dynamic_imports.rs:70:26:
called `Option::unwrap()` on a `None` value
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

-----
FATAL: An unexpected Turbopack error occurred. A panic log has been written to /var/folders/vh/r5pbsmwn4f37ch9153sj297w000
0gn/T/next-panic-429073751881a9b45a867bcd3c5143c5.log.

To help make Turbopack better, report this error by clicking here.
-----


> Build error occurred
Error [TurbopackInternalError]: Failed to write app endpoint /robots.txt/route

Caused by:
- called `Option::unwrap()` on a `None` value

Debug info:
- Execution of TaskId { id: 2147483650 } transient failed
- Execution of get_all_written_entrypoints_with_issues_operation failed
- Execution of EntrypointsOperation::new failed
- Execution of all_entrypoints_write_to_disk_operation failed
- Execution of Project::emit_all_output_assets failed
- Execution of *emit_assets failed
- Execution of all_assets_from_entries_operation failed
- Execution of *all_assets_from_entries failed
- Execution of output_assets_operation failed
- Execution of <AppEndpoint as Endpoint>::output failed
- Failed to write app endpoint /robots.txt/route
- Execution of AppEndpoint::output failed
- called `Option::unwrap()` on a `None` value
    at <unknown> (TurbopackInternalError: Failed to write app endpoint /robots.txt/route) {
  type: 'TurbopackInternalError',
  location: 'crates/next-api/src/dynamic_imports.rs:70:26'
}

---

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 24.6.0: Mon Jul 14 11:30:30 PDT 2025; root:xnu-11417.140.69~1/RELEASE_ARM64_T6020
  Available memory (MB): 16384
  Available CPU cores: 10
Binaries:
  Node: 22.17.0
  npm: 10.9.2
  Yarn: N/A
  pnpm: 9.0.0
Relevant Packages:
  next: 15.5.3 // Latest available version is detected (15.5.3).
  eslint-config-next: N/A
  react: 19.1.1
  react-dom: 19.1.1
  typescript: N/A
Next.js Config:
  output: N/A
RAW_BUFFERClick to expand / collapse

Link to the code that reproduces this issue

https://github.com/fullyherge/turbopack-build-error-monorepo-repro

To Reproduce

See README.md in reproduction repository.

Current vs. Expected behavior

Current: Build crashes with error:

> next build --turbopack

   ▲ Next.js 15.5.0 (Turbopack)

   Creating an optimized production build ...

thread 'tokio-runtime-worker' panicked at crates/next-api/src/dynamic_imports.rs:70:26:
called `Option::unwrap()` on a `None` value
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

-----
FATAL: An unexpected Turbopack error occurred. A panic log has been written to /var/folders/vh/r5pbsmwn4f37ch9153sj297w000
0gn/T/next-panic-429073751881a9b45a867bcd3c5143c5.log.

To help make Turbopack better, report this error by clicking here.
-----


> Build error occurred
Error [TurbopackInternalError]: Failed to write app endpoint /robots.txt/route

Caused by:
- called `Option::unwrap()` on a `None` value

Debug info:
- Execution of TaskId { id: 2147483650 } transient failed
- Execution of get_all_written_entrypoints_with_issues_operation failed
- Execution of EntrypointsOperation::new failed
- Execution of all_entrypoints_write_to_disk_operation failed
- Execution of Project::emit_all_output_assets failed
- Execution of *emit_assets failed
- Execution of all_assets_from_entries_operation failed
- Execution of *all_assets_from_entries failed
- Execution of output_assets_operation failed
- Execution of <AppEndpoint as Endpoint>::output failed
- Failed to write app endpoint /robots.txt/route
- Execution of AppEndpoint::output failed
- called `Option::unwrap()` on a `None` value
    at <unknown> (TurbopackInternalError: Failed to write app endpoint /robots.txt/route) {
  type: 'TurbopackInternalError',
  location: 'crates/next-api/src/dynamic_imports.rs:70:26'
}

Expected: For build to succeed

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 24.6.0: Mon Jul 14 11:30:30 PDT 2025; root:xnu-11417.140.69~1/RELEASE_ARM64_T6020
  Available memory (MB): 16384
  Available CPU cores: 10
Binaries:
  Node: 22.17.0
  npm: 10.9.2
  Yarn: N/A
  pnpm: 9.0.0
Relevant Packages:
  next: 15.5.3 // Latest available version is detected (15.5.3).
  eslint-config-next: N/A
  react: 19.1.1
  react-dom: 19.1.1
  typescript: N/A
Next.js Config:
  output: N/A

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

Turbopack, Metadata

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

next build (local)

Additional context

Tried going back to Next 15.3.0, the error is the same.

extent analysis

TL;DR

The build error is likely due to an issue with Turbopack in Next.js 15.5.0, and a potential workaround is to try disabling Turbopack or checking for any configuration issues.

Guidance

  • Check the next.config.js file for any custom configurations that might be causing the issue with Turbopack.
  • Try running the build command with the --no-turbopack flag to disable Turbopack and see if the build succeeds.
  • Verify that the robots.txt file is correctly configured and not causing any issues with the build process.
  • Consider reporting the issue to the Next.js team, as the error message suggests, to help improve Turbopack.

Notes

The issue seems to be related to Turbopack, and the error message provides a specific location in the code where the error occurs. However, without more information about the project's configuration and code, it's difficult to provide a more specific solution.

Recommendation

Apply workaround: Try disabling Turbopack or checking for any configuration issues, as this might resolve the build error.

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