{"record":{"id":"d710479e42bc9d94","repo":"kubernetes/kops","slug":"task-t-does-not-implement-hasname","errorCode":null,"errorMessage":"task %T does not implement HasName","messagePattern":"task %T does not implement HasName","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/template_functions.go","lineNumber":582,"sourceCode":"\t\t}\n\t}\n\tsort.Strings(keys)\n\n\tmatches := make([]fi.CloudupTask, 0, len(keys))\n\tfor _, key := range keys {\n\t\tmatches = append(matches, tasks[key])\n\t}\n\treturn matches, nil\n}\n\n// TaskKey returns the canonical task key used in the task map.\nfunc (tf *TemplateFunctions) TaskKey(task fi.CloudupTask) (string, error) {\n\tif task == nil {\n\t\treturn \"\", fmt.Errorf(\"task is nil\")\n\t}\n\thasName, ok := task.(fi.HasName)\n\tif !ok {\n\t\treturn \"\", fmt.Errorf(\"task %T does not implement HasName\", task)\n\t}\n\tname := fi.ValueOf(hasName.GetName())\n\tif name == \"\" {\n\t\treturn \"\", fmt.Errorf(\"task %T did not have a name\", task)\n\t}\n\treturn fi.TypeNameForTask(task) + \"/\" + name, nil\n}\n\n// SharedVPC is a simple helper function which makes the templates for a shared VPC clearer\nfunc (tf *TemplateFunctions) SharedVPC() bool {\n\treturn tf.Cluster.SharedVPC()\n}\n\n// GetInstanceGroup returns the instance group with the specified name\nfunc (tf *TemplateFunctions) GetInstanceGroup(name string) (*kops.InstanceGroup, error) {\n\tig := tf.KopsModelContext.FindInstanceGroup(name)\n\tif ig == nil {\n\t\treturn nil, fmt.Errorf(\"InstanceGroup %q not found\", name)","sourceCodeStart":564,"sourceCodeEnd":600,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/template_functions.go#L564-L600","documentation":"A type-assertion guard in TaskKey: the given task's concrete Go type does not implement the fi.HasName interface (no GetName() method). TaskKey requires a name to build the map key, so anonymous/nameless task types cannot be keyed and are rejected here.","triggerScenarios":"Thrown at upup/pkg/fi/cloudup/template_functions.go:582 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Give the task type a GetName() *string method so it satisfies fi.HasName","If the task is legitimately nameless, do not pass it to TaskKey; use a different lookup strategy","Check for a value vs pointer receiver mismatch — the method may exist on *T while a T was passed"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"4c8573c808a73d578c5eadc86d410646ea0b0d73","analyzedAt":"2026-09-05T04:13:19.212Z","contentChangedAt":"2026-09-05T04:13:19.212Z","schemaVersion":2},"datasetVersion":"2026-09-12T07:17:12.445Z"}