{"record":{"id":"43cd564a90bbea26","repo":"facebook/react","slug":"cannot-access-expression-on-the-server-you-can","errorCode":null,"errorMessage":"Cannot access ${expression} on the server. You cannot dot into a client module from a server component. You can only pass the imported name through.","messagePattern":"Cannot access (.+?) on the server\\. You cannot dot into a client module from a server component\\. You can only pass the imported name through\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/react-server-dom-turbopack/src/ReactFlightTurbopackReferences.js","lineNumber":197,"sourceCode":"        // $FlowFixMe[prop-missing]\n        return Object.prototype[Symbol.toPrimitive];\n      case Symbol.toStringTag:\n        // $FlowFixMe[prop-missing]\n        return Object.prototype[Symbol.toStringTag];\n      case 'Provider':\n        // Context.Provider === Context in React, so return the same reference.\n        // This allows server components to render <ClientContext.Provider>\n        // which will be serialized and executed on the client.\n        return receiver;\n      case 'then':\n        throw new Error(\n          `Cannot await or return from a thenable. ` +\n            `You cannot await a client module from a server component.`,\n        );\n    }\n    // eslint-disable-next-line react-internal/safe-string-coercion\n    const expression = String(target.name) + '.' + String(name);\n    throw new Error(\n      `Cannot access ${expression} on the server. ` +\n        'You cannot dot into a client module from a server component. ' +\n        'You can only pass the imported name through.',\n    );\n  },\n  set: function () {\n    throw new Error('Cannot assign to a client module from a server module.');\n  },\n};\n\nfunction getReference(target: Function, name: string | symbol): $FlowFixMe {\n  switch (name) {\n    // These names are read by the Flight runtime if you end up using the exports object.\n    case '$$typeof':\n      return target.$$typeof;\n    case '$$id':\n      return target.$$id;\n    case '$$async':","sourceCodeStart":179,"sourceCodeEnd":215,"githubUrl":"https://github.com/facebook/react/blob/eafeac097ba51e1eab809c07102126bd5f8e5425/packages/react-server-dom-turbopack/src/ReactFlightTurbopackReferences.js#L179-L215","documentation":"The deep-proxy get trap on client references only allows a few framework names ($$typeof, $$id, Provider on contexts, symbol protocol hooks). Any other dot-access throws because the server cannot read a value whose implementation lives in client code; client references may only be passed through to client components.","triggerScenarios":"`ClientModule.Chart.version`, destructuring `const {theme} = clientModule.styles`, or reading any property of a 'use client' export from server code.","commonSituations":"Constants/config that happen to live in a 'use client' file; barrel files mixing client components with shared values; server code trying to inspect a client import.","solutions":["Move the needed value to a server/shared module without 'use client'","Pass the whole reference through to a client component and read the property on the client","Split barrel files so server code never imports client barrels"],"exampleFix":"// before (server component)\nimport * as UI from './ui-client';\nconst version = UI.Chart.version; // Error: cannot dot into a client module\n\n// after\nimport {CHART_VERSION} from './constants'; // plain server module\n// pass <UI.Chart /> through instead of reading its internals","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"const CLIENT_REFERENCE = Symbol.for('react.client.reference');\nfunction isClientReference(value) {\n  return value != null && (typeof value === 'object' || typeof value === 'function') && value.$$typeof === CLIENT_REFERENCE;\n}\nfunction assertPassThrough(value) {\n  if (isClientReference(value)) {\n    return; // OK: forward as prop / render as component\n  }\n  return value; // plain server value: safe to read properties\n}","tryCatchPattern":null,"preventionTips":["Keep constants out of 'use client' files","Pass references whole; never read their properties on the server","Split barrels so server code never imports client barrels"],"tags":["react-server-components","turbopack","client-references","use-client","proxy"],"backgroundTag":"rsc-client-server-boundary","analyzedSha":"eafeac097ba51e1eab809c07102126bd5f8e5425","analyzedAt":"2026-08-21T22:01:08.818Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}