{"record":{"id":"d32a4a7a4444b996","repo":"facebook/react","slug":"438-d32a4a","errorCode":"438","errorMessage":"An unsupported type was passed to use(): %s","messagePattern":"An unsupported type was passed to use\\(\\): (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/react-server/src/ReactFlightHooks.js","lineNumber":165,"sourceCode":"      return trackUsedThenable(thenableState, thenable, index);\n    } else if (usable.$$typeof === REACT_CONTEXT_TYPE) {\n      unsupportedContext();\n    }\n  }\n\n  if (isClientReference(usable)) {\n    const clientReference: any = usable;\n    if (\n      clientReference.value != null &&\n      clientReference.value.$$typeof === REACT_CONTEXT_TYPE\n    ) {\n      // Show a more specific message since it's a common mistake.\n      throw new Error('Cannot read a Client Context from a Server Component.');\n    } else {\n      throw new Error('Cannot use() an already resolved Client Reference.');\n    }\n  } else {\n    throw new Error(\n      // eslint-disable-next-line react-internal/safe-string-coercion\n      'An unsupported type was passed to use(): ' + String(usable),\n    );\n  }\n}\n","sourceCodeStart":147,"sourceCodeEnd":171,"githubUrl":"https://github.com/facebook/react/blob/eafeac097ba51e1eab809c07102126bd5f8e5425/packages/react-server/src/ReactFlightHooks.js#L147-L171","documentation":"use() supports thenables, React contexts, and on the server client references that resolve to contexts. Anything else - primitives, plain objects without a then method, null - falls through to the final branch and throws with the stringified value appended.","triggerScenarios":"Calling use(42), use(null), use('text'), or use({a: 1}) from shared or server code; generic code like use(maybePromise ?? fallbackObject) where the fallback is not a thenable.","commonSituations":"Loosely-typed wrappers calling use() on unknown input; optional chains that silently produce undefined; data flows where a plain result object is mistaken for a promise.","solutions":["Only call use() on values confirmed to be promises/thenables; otherwise await the value or use it directly.","Narrow before calling: x && typeof x.then === 'function' ? use(x) : x.","Fix the data flow so only promises or contexts can reach the use() call site."],"exampleFix":"// before\nconst value = use(input ?? {fallback: true}); // plain object reaches use()\n\n// after\nconst value = input != null ? use(input) : {fallback: true};","handlingStrategy":"type-guard","validationCode":"const REACT_CONTEXT = Symbol.for('react.context');\nfunction isUsable(x: unknown): boolean {\n  if (!x) return false;\n  if (typeof x === 'object' || typeof x === 'function') {\n    if (typeof (x as any).then === 'function') return true; // thenable\n    if ((x as any).$$typeof === REACT_CONTEXT) return true; // context\n  }\n  return false;\n}\nconst value = isUsable(input) ? use(input) : input;","typeGuard":"function isThenable<T>(x: unknown): x is PromiseLike<T> {\n  return !!x && typeof (x as PromiseLike<T>).then === 'function';\n}\nfunction isReactContext(x: unknown): boolean {\n  return !!x && (x as any).$$typeof === Symbol.for('react.context');\n}","tryCatchPattern":null,"preventionTips":["Type the input of any wrapper that calls use() so only promises/contexts can flow in.","Check for a then method before calling use() on unknown values.","Avoid optional chaining into use(): use(input ?? fallback) lets plain objects reach the hook."],"tags":["react","use","type-error","hooks"],"backgroundTag":"react-use-invalid-argument","analyzedSha":"eafeac097ba51e1eab809c07102126bd5f8e5425","analyzedAt":"2026-08-21T22:01:08.818Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}