{"record":{"id":"fc15051254b4d4d0","repo":"vuetifyjs/vuetify","slug":"foo","errorCode":null,"errorMessage":"foo","messagePattern":"foo","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/vuetify/src/components/VDataTable/composables/expand.ts","lineNumber":83,"sourceCode":"    const rawValue = toRaw(item.value)\n    return [...expanded.value].some(x => toRaw(x) === rawValue)\n  }\n\n  function toggleExpand (item: DataTableItem) {\n    expand(item, !isExpanded(item))\n  }\n\n  const data = { expand, expanded, expandOnClick, isExpanded, toggleExpand }\n\n  provide(VDataTableExpandedKey, data)\n\n  return data\n}\n\nexport function useExpanded () {\n  const data = inject(VDataTableExpandedKey)\n\n  if (!data) throw new Error('foo')\n\n  return data\n}\n","sourceCodeStart":65,"sourceCodeEnd":87,"githubUrl":"https://github.com/vuetifyjs/vuetify/blob/8d153908dffb7592eb389ddbfbab955a0ccc977f/packages/vuetify/src/components/VDataTable/composables/expand.ts#L65-L87","documentation":"Thrown by useExpanded() in VDataTable when inject(VDataTableExpandedKey) returns undefined. The composable expects to find expansion state provided by createExpanded() higher in the component tree. (The literal message 'foo' is a known placeholder — it does not change behavior.)","triggerScenarios":"Calling useExpanded() outside of a VDataTable/VDataTableServer/VDataTableVirtual (or a component that called createExpanded). Typically hit by slot/slot-prop consumers or by exporting a child composable from a wrapper component that is rendered without the table provider.","commonSituations":"Using the table's internal composables in a custom standalone component, rendering a cell slot outside the table's provide scope, or upgrading Vuetify where the data-table was refactored to injection-key-based composables (Vuetify 3 / Labs).","solutions":["Only call useExpanded() inside a component that is a descendant of a VDataTable-family component.","If building a custom table, call createExpanded(...) yourself and provide VDataTableExpandedKey before useExpanded().","Move the composable call into the setup function of a component that lives within the table's slot tree."],"exampleFix":"// before — useExpanded() called in a standalone component with no table ancestor\nconst { expanded } = useExpanded()\n\n// after — only call inside a VDataTable slot descendant, or provide it yourself:\nimport { createExpanded, VDataTableExpandedKey } from 'vuetify/components/VDataTable/composables/expand'\n// in your custom table setup:\nconst data = createExpanded(/* props */, /* emit */)\nprovide(VDataTableExpandedKey, data)\n// descendants may now call useExpanded()","handlingStrategy":"type-guard","validationCode":"// structural check before calling the composable\nimport { getCurrentInstance } from 'vue'\nfunction canUseExpanded(): boolean {\n  // only meaningful if a VDataTable ancestor is present; check injection lazily\n  return !!getCurrentInstance()\n}","typeGuard":"import { inject } from 'vue'\nimport { VDataTableExpandedKey } from 'vuetify/components/VDataTable/composables/expand'\nfunction hasExpandedProvider(): boolean {\n  return inject(VDataTableExpandedKey, null) != null\n}","tryCatchPattern":"try {\n  const { expanded } = useExpanded()\n} catch (e) {\n  if (e instanceof Error && e.message === 'foo') {\n    // not inside a table; fall back to local state\n  } else throw e\n}","preventionTips":["Keep composables that consume table state inside table slot descendants only.","When extracting table internals, also re-provide the symbols you consume.","Maintain a single Vuetify install to keep Symbol.for keys identical."],"tags":["vdatatable","injection","composable-misuse","vue"],"backgroundTag":null,"analyzedSha":"8d153908dffb7592eb389ddbfbab955a0ccc977f","analyzedAt":"2026-08-12T21:54:20.596Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}