{"record":{"id":"ac0018afd2aba2d6","repo":"GoogleContainerTools/skaffold","slug":"deleting-v-job","errorCode":null,"errorMessage":"deleting %v job","messagePattern":"deleting (.+?) job","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/skaffold/k8sjob/util.go","lineNumber":146,"sourceCode":"\t\t\t\t},\n\t\t\t\tSpec: corev1.PodSpec{},\n\t\t\t},\n\t\t},\n\t}\n}\n\nfunc ForceJobDelete(ctx context.Context, jobName string, jobsManager typesbatchv1.JobInterface, kubectl *kubectl.CLI) error {\n\terr := WithRetryablePoll(ctx, func(ctx context.Context) error {\n\t\t_, err := jobsManager.Get(ctx, jobName, metav1.GetOptions{})\n\t\treturn err\n\t})\n\n\tif apierrs.IsNotFound(err) {\n\t\treturn nil\n\t}\n\n\tif err != nil {\n\t\treturn errors.Wrap(err, fmt.Sprintf(\"deleting %v job\", jobName))\n\t}\n\n\terr = WithRetryablePoll(ctx, func(ctx context.Context) error {\n\t\treturn jobsManager.Delete(ctx, jobName, metav1.DeleteOptions{\n\t\t\tGracePeriodSeconds: util.Ptr[int64](0),\n\t\t\tPropagationPolicy:  util.Ptr(metav1.DeletePropagationForeground),\n\t\t})\n\t})\n\n\tif err != nil && !apierrs.IsNotFound(err) {\n\t\treturn err\n\t}\n\n\treturn deleteJobPod(ctx, jobName, kubectl)\n}\n\nfunc deleteJobPod(ctx context.Context, jobName string, kubectl *kubectl.CLI) error {\n\t// We execute the Pods delete with the kubectl CLI client to be able to force the deletion.","sourceCodeStart":128,"sourceCodeEnd":164,"githubUrl":"https://github.com/GoogleContainerTools/skaffold/blob/a1189de023efc32d4b8e11f395acc678aa555011/pkg/skaffold/k8sjob/util.go#L128-L164","documentation":"Fires in ForceJobDelete when the pre-delete existence poll for the Kubernetes Job errors with something other than NotFound (e.g. API connectivity or permission failure) — the subsequent deletion is wrapped with the job name for context. This wraps the API error, not the deletion itself.","triggerScenarios":"Thrown at pkg/skaffold/k8sjob/util.go:146 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check cluster connectivity and RBAC permissions for reading/deleting Jobs in the namespace","Verify the namespace and job name are correct (kubectl get jobs -A)","Retry after transient API-server/network issues resolve"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a1189de023efc32d4b8e11f395acc678aa555011","analyzedAt":"2026-09-05T12:09:27.064Z","contentChangedAt":"2026-09-05T12:09:27.064Z","schemaVersion":2},"datasetVersion":"2026-09-12T17:17:11.597Z"}