{"record":{"id":"dfee51390abf07c7","repo":"kubernetes/kops","slug":"failed-to-find-lifecycle-hook-q-w","errorCode":null,"errorMessage":"failed to find lifecycle hook %q: %w","messagePattern":"failed to find lifecycle hook %q: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/nodeup/command.go","lineNumber":440,"sourceCode":"\t\treturn \"\", fmt.Errorf(\"failed to get instance metadata type: %w\", err)\n\t}\n\tdefer result.Content.Close()\n\tinstanceTypeName, err := io.ReadAll(result.Content)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"failed to read instance metadata response: %w\", err)\n\t}\n\treturn string(instanceTypeName), err\n}\n\nfunc completeWarmingLifecycleAction(ctx context.Context, cloud *awsup.Cloud, modelContext *model.NodeupModelContext) error {\n\tasgName := modelContext.BootConfig.InstanceGroupName + \".\" + modelContext.NodeupConfig.ClusterName\n\thookName := \"kops-warmpool\"\n\thooks, err := cloud.DescribeLifecycleHooks(ctx, &autoscaling.DescribeLifecycleHooksInput{\n\t\tAutoScalingGroupName: &asgName,\n\t\tLifecycleHookNames:   []string{hookName},\n\t})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to find lifecycle hook %q: %w\", hookName, err)\n\t}\n\n\tif len(hooks.LifecycleHooks) > 0 {\n\t\tklog.Info(\"Found ASG lifecycle hook\")\n\t\t_, err := cloud.CompleteLifecycleAction(ctx, &autoscaling.CompleteLifecycleActionInput{\n\t\t\tAutoScalingGroupName:  &asgName,\n\t\t\tInstanceId:            &modelContext.InstanceID,\n\t\t\tLifecycleHookName:     &hookName,\n\t\t\tLifecycleActionResult: new(\"CONTINUE\"),\n\t\t})\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to complete lifecycle hook %q for %q: %v\", hookName, modelContext.InstanceID, err)\n\t\t}\n\t\tklog.Info(\"Lifecycle action completed\")\n\t} else {\n\t\tklog.Info(\"No ASG lifecycle hook found\")\n\t}\n\treturn nil","sourceCodeStart":422,"sourceCodeEnd":458,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/nodeup/command.go#L422-L458","documentation":"completeWarmingLifecycleAction describes the lifecycle hook named 'kops-warmpool' on the ASG '<instancegroup>.<clustername>'. If the DescribeLifecycleHooks API call itself errors (as opposed to returning zero hooks), nodeup wraps the AWS error with this message and the Run() call fails.","triggerScenarios":"cloud.DescribeLifecycleHooks fails: IAM permission denied for autoscaling:DescribeLifecycleHooks, nonexistent/wrong ASG name, AWS API throttling, or regional/network failure.","commonSituations":"Node IAM role missing DescribeLifecycleHooks permission; instance group renamed so the ASG lookup name no longer matches; ASG is in a different region than the node's configured region; SDK throttling during large scale-ups.","solutions":["Grant the node instance role autoscaling:DescribeLifecycleHooks (scoped to the cluster ASGs if possible).","Verify the ASG name <ig>.<cluster> exists in the node's region (aws autoscaling describe-auto-scaling-groups).","Check the wrapped AWS error code: AuthorizationError -> permissions, ValidationError -> ASG name, Throttling -> backoff/retry.","Ensure nodeup and cluster spec versions agree so hook/ASG naming conventions match."],"exampleFix":"// before\n// (no autoscaling:DescribeLifecycleHooks on node role)\n// after\n{\"Effect\":\"Allow\",\"Action\":\"autoscaling:DescribeLifecycleHooks\",\"Resource\":\"*\"}","handlingStrategy":"try-catch","validationCode":"aws iam simulate-principal-policy --policy-source-arn <nodeRoleArn> --action-names autoscaling:DescribeLifecycleHooks --resource-arns '*'","typeGuard":null,"tryCatchPattern":"hooks, err := cloud.DescribeLifecycleHooks(ctx, input)\nif err != nil {\n    var ae smithy.APIError\n    if errors.As(err, &ae) {\n        switch ae.ErrorCode() {\n        case \"AccessDenied\": // fix IAM\n        case \"ValidationError\": // wrong ASG name\n        case \"ThrottlingException\": // backoff & retry\n        }\n    }\n    return fmt.Errorf(\"failed to find lifecycle hook %q: %w\", hookName, err)\n}","preventionTips":["Grant DescribeLifecycleHooks to the node instance profile.","Keep instance group and cluster names stable (they form the ASG name).","Confirm nodeup's region matches the ASG's region.","Handle throttling with SDK retryer/backoff during scale-up storms."],"tags":["aws","autoscaling","lifecycle-hook","iam"],"backgroundTag":"aws-access-denied","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"}