{"record":{"id":"a89629fc7916e3ec","repo":"kubernetes/kubernetes","slug":"dra-driver-name-is-empty","errorCode":null,"errorMessage":"DRA driver name is empty","messagePattern":"DRA driver name is empty","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/kubelet/cm/dra/plugin/dra_plugin_manager.go","lineNumber":276,"sourceCode":"\t\t\treturn true, nil\n\t\tdefault:\n\t\t\t// Log and retry for other errors.\n\t\t\tlogger.V(3).Info(\"Deleting ResourceSlice failed, retrying\", \"fieldSelector\", fieldSelector, \"err\", err)\n\t\t\treturn false, nil\n\t\t}\n\t})\n}\n\n// GetPlugin returns a wrapper around those gRPC methods of a DRA\n// driver kubelet plugin which need to be called by kubelet. The wrapper\n// handles gRPC connection management and logging. Connections are reused\n// across different calls.\n//\n// It returns an informative error message including the driver name\n// with an explanation why the driver is not usable.\nfunc (pm *DRAPluginManager) GetPlugin(driverName string) (*DRAPlugin, error) {\n\tif driverName == \"\" {\n\t\treturn nil, errors.New(\"DRA driver name is empty\")\n\t}\n\tplugin := pm.get(driverName)\n\tif plugin == nil {\n\t\treturn nil, fmt.Errorf(\"DRA driver %s is not registered\", driverName)\n\t}\n\treturn plugin, nil\n}\n\n// get lets you retrieve a DRA DRAPlugin by name.\nfunc (pm *DRAPluginManager) get(driverName string) *DRAPlugin {\n\tpm.mutex.RLock()\n\tdefer pm.mutex.RUnlock()\n\n\tlogger := klog.FromContext(pm.backgroundCtx)\n\n\tplugins := pm.store[driverName]\n\tif len(plugins) == 0 {\n\t\tlogger.V(5).Info(\"No plugin registered\", \"driverName\", driverName)","sourceCodeStart":258,"sourceCodeEnd":294,"githubUrl":"https://github.com/kubernetes/kubernetes/blob/b882c60b4023bdf09264c2d5d30a2cadebc240fb/pkg/kubelet/cm/dra/plugin/dra_plugin_manager.go#L258-L294","documentation":"Returned by DRAPluginManager.GetPlugin() (dra_plugin_manager.go:274-277) when the caller passes an empty driverName. DRA plugins are keyed by driver name, so an empty name has no registered plugin and is treated as a programming error rather than a missing-plugin condition.","triggerScenarios":"GetPlugin(\"\") is called. This typically stems from a ResourceClaim/Device whose allocation result has an empty Driver field, which then flows into the plugin lookup.","commonSituations":"Upstream data integrity issue: a ResourceClaim allocation result with an empty driver string (should be rejected by API validation but slipped through). Local testing with hand-crafted claim objects. Race where the driver name isn't yet populated.","solutions":["Inspect the ResourceClaim allocation: kubectl get resourceclaim <name> -o jsonpath='{.status.allocation.devices.results[*].driver}' and confirm no empty values.","Ensure the DRA driver writes a non-empty driver name in its allocation results.","In callers, guard against empty driverName before calling GetPlugin and surface a clearer upstream error."],"exampleFix":"// before\nplugin, err := pm.GetPlugin(claimDriver)\n// after\nif claimDriver == \"\" {\n    return fmt.Errorf(\"resource claim %s has empty DRA driver\", klog.KObj(claim))\n}\nplugin, err := pm.GetPlugin(claimDriver)","handlingStrategy":"validation","validationCode":"if driverName == \"\" {\n    return errors.New(\"cannot resolve DRA plugin: driver name is empty\")\n}\nplugin, err := pm.GetPlugin(driverName)","typeGuard":"func hasNonEmptyDriverName(results []resourceapi.DeviceRequestAllocationResult) bool {\n    for _, r := range results {\n        if r.Driver == \"\" {\n            return false\n        }\n    }\n    return true\n}","tryCatchPattern":null,"preventionTips":["Validate allocation results for non-empty Driver before plugin lookup.","Ensure DRA drivers always populate the driver name.","Surface a clearer upstream error than the generic GetPlugin message."],"tags":["kubernetes","kubelet","dra","validation","plugin","go"],"analyzedSha":"b882c60b4023bdf09264c2d5d30a2cadebc240fb","analyzedAt":"2026-08-07T04:07:48.144Z","schemaVersion":2},"datasetVersion":"2026-08-07T07:17:06.508Z"}