{"record":{"id":"e83007a4c73dbf60","repo":"TanStack/table","slug":"usecellcontext-must-be-used-within-an-appcell-e83007","errorCode":null,"errorMessage":"`useCellContext` must be used within an `AppCell` component. Make sure your component is wrapped with `<table.AppCell cell={cell}>...</table.AppCell>`.","messagePattern":"`useCellContext` must be used within an `AppCell` component\\. Make sure your component is wrapped with `<table\\.AppCell cell=(.+?)>\\.\\.\\.</table\\.AppCell>`\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/solid-table/src/createTableHook.tsx","lineNumber":714,"sourceCode":"   *   return <span>{cell.getValue()}</span>\n   * }\n   *\n   * function NumberCell({ format }: { format?: Intl.NumberFormatOptions }) {\n   *   const cell = useCellContext<number>()\n   *   return <span>{cell.getValue().toLocaleString(undefined, format)}</span>\n   * }\n   * ```\n   */\n  function useCellContext<TValue extends CellData = CellData>(): Cell<\n    TFeatures,\n    any,\n    TValue\n  > &\n    TCellComponents & { FlexRender: () => JSXElement } {\n    const cell = useContext(CellContext)\n\n    if (!cell) {\n      throw new Error(\n        '`useCellContext` must be used within an `AppCell` component. ' +\n          'Make sure your component is wrapped with `<table.AppCell cell={cell}>...</table.AppCell>`.',\n      )\n    }\n\n    // `<table.AppCell>` Object.assign-es `cellComponents` and `FlexRender` onto\n    // the same cell instance it provides, so this asserts the runtime shape.\n    return cell as unknown as Cell<TFeatures, any, TValue> &\n      TCellComponents & { FlexRender: () => JSXElement }\n  }\n\n  /**\n   * Access the header instance from within an `AppHeader` or `AppFooter` wrapper.\n   * Use this in custom `headerComponents` passed to `createTableHook`.\n   * TFeatures is already known from the createTableHook call.\n   *\n   * @example\n   * ```tsx","sourceCodeStart":696,"sourceCodeEnd":732,"githubUrl":"https://github.com/TanStack/table/blob/d01c01bedbab0ff6c2641f18b2fc9a11545d9bf6/packages/solid-table/src/createTableHook.tsx#L696-L732","documentation":"`useCellContext` in the Solid adapter reads the cell context provided by `<table.AppCell cell={cell}>`. Without that provider above the caller, the context is undefined and this error is thrown, so cell APIs are only reachable with a real cell. AppCell also attaches `cellComponents` and `FlexRender` to the cell instance it provides.","triggerScenarios":"Calling `useCellContext()` in a component outside `<table.AppCell cell={cell}>`; rendering via solid Portal outside the provider; duplicate solid-table installs breaking context identity.","commonSituations":"Custom Solid cell renderers extracted into shared components without a provider; isolated test mounts; version duplication in monorepos.","solutions":["Wrap the component with `<table.AppCell cell={cell}>...</table.AppCell>`.","Move the component into AppCell's children in the column def's cell renderer.","Dedupe solid-table so all consumers share one context module.","Use `useContext(CellContext)` directly with a null check when the cell may be absent."],"exampleFix":"// before\nfunction CellBadge() {\n  const cell = useCellContext()\n  return <span>{String(cell.getValue())}</span>\n}\n\n// after\n<table.AppCell cell={cell}>\n  <CellBadge />\n</table.AppCell>","handlingStrategy":"validation","validationCode":"import { useContext } from 'solid-js'\nimport { CellContext } from '@your-scope/solid-table'\n\nfunction useSafeCell() {\n  const cell = useContext(CellContext)\n  if (!cell) {\n    console.error('useCellContext requires <table.AppCell cell={cell}> above this component')\n  }\n  return cell\n}","typeGuard":"function hasCell<T>(c: T | null | undefined): c is T {\n  return c != null\n}","tryCatchPattern":"try {\n  const cell = useCellContext()\n  // use cell\n} catch (err) {\n  if (err instanceof Error && err.message.includes('useCellContext')) {\n    return null\n  }\n  throw err\n}","preventionTips":["Wrap Solid cell widgets with <table.AppCell cell={cell}> in the cell renderer.","Keep provider and consumer in the same reactive root.","Check for duplicate solid-table installs.","Mount test subjects inside AppCell."],"tags":["solid","solid-context","missing-provider"],"backgroundTag":"missing-context-provider","analyzedSha":"d01c01bedbab0ff6c2641f18b2fc9a11545d9bf6","analyzedAt":"2026-08-28T21:52:44.679Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}