Turbopack Error: internal error: entered unreachable code: there must be a path to a root #82277
Replies: 1 comment
-
I am absolutely confused, which is why I'll leave some of the things I've found out here. My lack of deeper understanding when turbopack(?) decides to execute and import things leave me quite riddled. From what I understand, there must have been some change in how the turbopack resolves imports with Next.js v15.4.1 TL;DRA circular dependency of some sort causes the turbopack Not too long, I am curiousFor the sake of keeping this a minimal example, let's just say we want to call another function on startup that gives us a value we can log. I now realize that the placement of some code is not ideal, but let's ignore this for now - I am just trying to provide insight for anyone struggling with this in the future. To achieve that, we added the following to the import { getEnv } from '@/getEnv'
let logger
const setupSpecialLogger = () => {
logger = console
}
export const specialLogger = (text: string) => {
setupSpecialLogger()
logger!.log(text)
}
export async function register() {
specialLogger(await getEnv())
} As the name suggest, we want to setup our logger here. Let's keep it simple and just use console here for the example, while this would obviously be more complex with a proper custom logger. For now, this should still work. However, if we implement the import { specialLogger } from '@/instrumentation'
export const getEnv = async () => {
specialLogger(`We're returning the env value here`)
return process.env.THE_VALUE
} This is, to my understanding, because of the circular imports. Why it didn't crash before but starts crashing with 15.4.1 => I don't know. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Turbopack version: >
v15.4.1
Next.js version: >
15.4.1
Error message:
Details:
Starting with Next.js 15.4.1, we get an error when trying to run
next dev --turbopack
.When setting `RUST_BACKTRACE=full`, there is some more information:
Running without
--turbopack
still works (obviously).I cannot find anything anywhere about this issue related to Next.js.
While I am aware of this being one of the annoying "crying for help" posts, I don't know what else to do. Therefore:
Any help is much appreciated!!
Beta Was this translation helpful? Give feedback.
All reactions