0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【Next.js】開発サーバーでUnhandleなエラーが発生した際にnext-code-frameのpanicが起きる

0
Posted at

概要

Next.jsで実装でハンドルしていないエラーが起きた場合、開発用のサーバー起動であれば通常は以下のようなスタックの表示がされると思います。
スクリーンショット 2026-09-12 18.20.22.png

しかしスタックが表示されず、next-code-frameでpanicが起きてサーバーが落ちてしまう事象に遭遇したので、今回はその内容をメモ書きしておきます。

前提

  • 使用したNext.jsは16.2.12です。

事象の詳細など

[Error Overlay] Dev server aborts: next-code-frame panic on multi-byte source (terminal width)のissueにある通り、スタックを表示するハイライトの処理で日本語等のマルチバイト文字が含まれていると、panicが起きる場合があるそうです。next-code-frameの該当のコードはRustで書かれています。

いつからRustで実装になったのか

Reimplement code frame rendering in native codeのPull Requestから推測するに、Next.jsの16.2.1以降なのかなと思います。元々はbabel/code-frameを使用していたそうですが、メンテナンスやパフォーマンスなどの観点からこれを使用するのをやめてRust実装に切り替えたそうです。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?