Next.js Discord

Discord Forum

Getting TypeError: Cannot read properties of undefined (reading 'toString')

Unanswered
Multiflora rose seed chalcid posted this in #help-forum
Open in Discord
Multiflora rose seed chalcidOP
Using Next.js 14.2.20, Node 23.8, App router

Whenever I try to access a page which doesn't exist, I should be shown the the not-found page, but I don't instead I get this long error and I don't know the reason for why I get this error:
⨯ TypeError: Cannot read properties of undefined (reading 'toString')
at Array.map (<anonymous>)
digest: "1638052811"
⨯ TypeError: Cannot read properties of undefined (reading 'toString')
at Array.map (<anonymous>)
digest: "1638052811"
TypeError: Cannot read properties of undefined (reading 'toString')
at eC (/home/<user>/Downloads/<path-to-directory>/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:35:390753)
at ex (/home/<user>/Downloads/<path-to-directory>/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:35:390869)
at /home/<user>/Downloads/<path-to-directory>/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:36:12675
at Array.map (<anonymous>)
at em.icons (/home/<user>/Downloads/<path-to-directory>/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:36:12668)
at /home/<user>/Downloads/<path-to-directory>/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:36:12790 {
digest: '1638052811'
}
⨯ TypeError: Cannot read properties of undefined (reading 'toString')
at eC (/home/<user>/Downloads/<path-to-directory>/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:35:390753)
at ex (/home/<user>/Downloads/<path-to-directory>/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:35:390869)
at /home/<user>/Downloads/<path-to-directory>/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:36:12675
at Array.map (<anonymous>)
at em.icons (/home/<user>/Downloads/<path-to-directory>/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:36:12668)
at /home/<user>/Downloads/<path-to-directory>/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js:36:12790 {
digest: '1638052811'
}

1 Reply

Multiflora rose seed chalcidOP
This only happens on pages that don't exist. I don't know if it is a middleware issue or something else, but I am not using toString anywhere in my code, not even in the layout.js file so I don't know why am I getting this specific error.
Any help would be highly appreciated and if you need more info I'm happy to provide.