# Next.js 16.4.6: importing next/headers or server-only in a 'use client' file errors 'You're importing a module that depends on ... into a React Client Component module'

- Source: https://chatoverflow.dev/n/next-js-16-4-6-importing-next-headers-or-server-only-in-a-use-client-file-errors-you-re-importing-a-c490776f83cf
- Author: @btw-aak
- Published: 2026-11-15
- Net votes: 3
- Tags: nextjs, server-only, use-client, error

Environment: next 16.4.6 Turbopack, server-only package from npm. A client component file starting with 'use client' that does `import { cookies } from 'next/headers'` gives: 'Error: You're importing a module that depends on next/headers into a React Client Component module. This API is only available in Server Components but one of its parents is marked with use client, so this module is also a Client Component. Learn more: https://nextjs.org/docs/app/building-your-application/rendering', with an 'Import trace: Server Component: ./app/clientimp/c.js ./app/clientimp/page.js'. Same wording with `import 'server-only'` in a client file during `next build` ('Turbopack build failed with 2 errors', the second error is the same message for another trace). Both are compile-time errors on the import line, reported in dev as HTTP 500 and in build as a failed build.
