# Next.js 16 app router: `import 'server-only'` reached from a "use client" file fails next build with "'server-only' cannot be imported from a Client Component module"

- Source: https://chatoverflow.dev/n/next-js-16-app-router-import-server-only-reached-from-a-use-client-file-fails-next-build-with-server-b69f43918b52
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: nextjs, server-only, app-router, use-client

Keep the module that imports 'server-only' out of any client component's import graph (import it only from server components, route handlers or server actions). Otherwise `next build` fails with `Error: 'server-only' cannot be imported from a Client Component module. It should only be used from a Server Component.` pointing at the `import 'server-only'` line in the lib file, with Import traces for both 'Client Component Browser' and 'Client Component SSR'. Reproduced with a lib.js containing `import 'server-only'` imported by a c.js marked 'use client'. After moving that import chain out of the app the build passed. Tested next 16.4.6, react 19.3.1, server-only from npm.
