{"record":{"id":"42b5718e1b3122c8","repo":"TanStack/table","slug":"key-in-deeply-nested-key-accessorkey-ret","errorCode":null,"errorMessage":"\"${key}\" in deeply nested key \"${accessorKey}\" returned undefined.","messagePattern":"\"(.+?)\" in deeply nested key \"(.+?)\" returned undefined\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packages/table-core/src/core/columns/constructColumn.ts","lineNumber":78,"sourceCode":"      ? resolvedColumnDef.header\n      : undefined)\n\n  let accessorFn: AccessorFn<TData, TValue> | undefined\n\n  if (resolvedColumnDef.accessorFn) {\n    accessorFn = resolvedColumnDef.accessorFn\n  } else if (accessorKey !== undefined) {\n    // Support deep accessor keys\n    if (typeof accessorKey === 'string' && accessorKey.includes('.')) {\n      const keys = accessorKey.split('.')\n      accessorFn = (originalRow: TData) => {\n        let result = originalRow as Record<string, any> | undefined\n\n        for (let i = 0; i < keys.length; i++) {\n          const key = keys[i]!\n          result = result?.[key]\n          if (process.env.NODE_ENV === 'development' && result === undefined) {\n            console.warn(\n              `\"${key}\" in deeply nested key \"${accessorKey}\" returned undefined.`,\n            )\n          }\n        }\n\n        return result as TValue\n      }\n    } else {\n      accessorFn = (originalRow: TData) =>\n        (originalRow as any)[resolvedColumnDef.accessorKey]\n    }\n  }\n\n  if (!id) {\n    if (process.env.NODE_ENV === 'development') {\n      throw new Error(\n        resolvedColumnDef.accessorFn\n          ? `coreColumnsFeature require an id when using an accessorFn`","sourceCodeStart":60,"sourceCodeEnd":96,"githubUrl":"https://github.com/TanStack/table/blob/d01c01bedbab0ff6c2641f18b2fc9a11545d9bf6/packages/table-core/src/core/columns/constructColumn.ts#L60-L96","documentation":"When resolving an accessorKey with dot notation (e.g. 'user.address.city'), constructColumn walks each key segment against the row object. If any intermediate key resolves to undefined, it logs this warning in development, indicating the accessor path does not match the actual row data shape.","triggerScenarios":"Defining a column with accessorKey: 'a.b.c' where a row is missing property 'a' or 'b', or a typo like accessorKey: 'usr.name' when the data uses 'user.name'; rows where a nested object is null/undefined for some records.","commonSituations":"Backend API changes the JSON shape; inconsistent rows (some missing nested objects); typos in accessorKey; using dot notation against data that stores keys containing literal dots.","solutions":["Fix the accessorKey string so each dot-separated segment matches the row data exactly.","Log one row of your data and confirm the nested path exists on every record.","If rows legitimately lack the nested value, supply an accessorFn: row => row?.user?.address?.city ?? '' instead of accessorKey.","Normalize/transform API data so the nested structure matches the column definition."],"exampleFix":"// before\n{ accessorKey: 'usr.profile.name', header: 'Name' }\n\n// after\n{ accessorKey: 'user.profile.name', header: 'Name' }\n// or for nullable data:\n{ id: 'name', accessorFn: (row) => row?.user?.profile?.name ?? '', header: 'Name' }","handlingStrategy":"validation","validationCode":"function validateAccessorKey(data: any[], accessorKey: string): boolean {\n  return data.every((row) =>\n    accessorKey.split('.').reduce<any>((o, k) => (o == null ? undefined : o[k]), row) !== undefined\n  )\n}","typeGuard":"function hasPath<T, P extends string>(row: T, path: P): boolean {\n  return path.split('.').reduce<any>((o, k) => (o == null ? undefined : o[k]), row) !== undefined\n}","tryCatchPattern":null,"preventionTips":["Prefer accessorFn with optional chaining over dotted accessorKey for nullable nested data.","Add a dev-time test asserting every fixture row resolves each column's accessorKey.","Keep column accessors in sync with API response types via TypeScript types on row data.","When the API shape changes, grep for the old path in column definitions."],"tags":["accessor","nested-data","columns","undefined"],"backgroundTag":"invalid-accessor-key-path","analyzedSha":"d01c01bedbab0ff6c2641f18b2fc9a11545d9bf6","analyzedAt":"2026-08-28T21:52:44.679Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}