{"record":{"id":"63a6dfaf84a91231","repo":"vuetifyjs/vuetify","slug":"vuetify-could-not-determine-component-name","errorCode":null,"errorMessage":"[Vuetify] Could not determine component name","messagePattern":"\\[Vuetify\\] Could not determine component name","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/vuetify/src/composables/defaults.ts","lineNumber":103,"sourceCode":"\n  return newDefaults\n}\n\nfunction propIsDefined (vnode: VNode, prop: string) {\n  return vnode.props && (typeof vnode.props[prop] !== 'undefined' ||\n    typeof vnode.props[toKebabCase(prop)] !== 'undefined')\n}\n\nexport function internalUseDefaults (\n  props: Record<string, any> = {},\n  name?: string,\n  defaults = injectDefaults()\n) {\n  const vm = getCurrentInstance('useDefaults')\n\n  name = name ?? vm.type.name ?? vm.type.__name\n  if (!name) {\n    throw new Error('[Vuetify] Could not determine component name')\n  }\n\n  const componentDefaults = computed(() => defaults.value?.[props._as ?? name])\n  const _props = new Proxy(props, {\n    get (target, prop: string) {\n      const propValue = Reflect.get(target, prop)\n      if (prop === 'class' || prop === 'style') {\n        return [componentDefaults.value?.[prop], propValue].filter(v => v != null)\n      }\n      if (propIsDefined(vm.vnode, prop)) return propValue\n      const _componentDefault = componentDefaults.value?.[prop]\n      if (_componentDefault !== undefined) return _componentDefault\n      const _globalDefault = defaults.value?.global?.[prop]\n      if (_globalDefault !== undefined) return _globalDefault\n      return propValue\n    },\n  })\n","sourceCodeStart":85,"sourceCodeEnd":121,"githubUrl":"https://github.com/vuetifyjs/vuetify/blob/8d153908dffb7592eb389ddbfbab955a0ccc977f/packages/vuetify/src/composables/defaults.ts#L85-L121","documentation":"Thrown by internalUseDefaults() when the current component instance has neither `name` nor `__name` on its type. The composable needs a name to look up component-specific defaults. SFCs compiled with name inference set __name; an anonymous component (e.g. a render function or defineComponent without name) has neither.","triggerScenarios":"Calling useDefaults() inside an anonymous component — a plain object component without a `name` field, an inline functional/render component, or an SFC whose compiler did not emit __name.","commonSituations":"Custom components that adopt Vuetify's defaults system but were authored without a name; components created via h()/render functions; or a bundler/loader config that strips the name inference.","solutions":["Give the component an explicit `name` in its options (defineComponent({ name: 'MyComp', ... })).","Pass the name explicitly as the second argument to useDefaults(props, 'MyComp').","For SFCs, ensure the vue compiler emits __name (default in modern @vitejs/plugin-vue)."],"exampleFix":"// before\nexport default defineComponent({\n  setup () {\n    const defaults = useDefaults() // throws: no name\n    return {}\n  },\n})\n\n// after\nexport default defineComponent({\n  name: 'MyCard',\n  setup () {\n    const defaults = useDefaults()\n    return {}\n  },\n})\n// or pass it explicitly:\nuseDefaults({}, 'MyCard')","handlingStrategy":"validation","validationCode":"import { getCurrentInstance } from 'vue'\n\nfunction ensureComponentName(explicit?: string): string {\n  const vm = getCurrentInstance()\n  const name = explicit ?? vm?.type.name ?? vm?.type.__name\n  if (!name) throw new TypeError('Component using useDefaults needs a name')\n  return name\n}","typeGuard":"import { getCurrentInstance } from 'vue'\nfunction componentHasName(): boolean {\n  const vm = getCurrentInstance()\n  return !!(vm?.type.name ?? vm?.type.__name)\n}","tryCatchPattern":null,"preventionTips":["Always set `name` on components that use useDefaults().","Pass the name explicitly as the second arg when in doubt.","Keep <script setup> compiler name-inference enabled."],"tags":["vuetify","defaults","vue","component-name"],"backgroundTag":null,"analyzedSha":"8d153908dffb7592eb389ddbfbab955a0ccc977f","analyzedAt":"2026-08-12T21:54:20.596Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}