{"record":{"id":"e607a65066bac8ae","repo":"kubernetes/kops","slug":"not-all-assets-copied-successfully","errorCode":null,"errorMessage":"not all assets copied successfully","messagePattern":"not all assets copied successfully","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/assets/assetcopy/copy.go","lineNumber":123,"sourceCode":"\t\t\terr := t.Run()\n\t\t\tif err != nil {\n\t\t\t\terr = fmt.Errorf(\"%s: %v\", n, err)\n\t\t\t}\n\t\t\tch <- err\n\t\t}(name, task)\n\t}\n\n\tfor i := 0; i < cap(ch); i++ {\n\t\terr := <-ch\n\t\tif err != nil {\n\t\t\tklog.Warning(err)\n\t\t\tgotError = true\n\t\t}\n\t}\n\n\tclose(ch)\n\tif gotError {\n\t\treturn fmt.Errorf(\"not all assets copied successfully\")\n\t}\n\treturn nil\n}\n","sourceCodeStart":105,"sourceCodeEnd":127,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/pkg/assets/assetcopy/copy.go#L105-L127","documentation":"After all asset copy tasks complete, if any task logged a warning (gotError=true), Copy() discards the individual details and returns this aggregate sentinel error. It tells the caller (RunGetAssets / `kops get assets --copy`) that at least one asset was not copied; the per-asset errors were already printed via klog.Warning.","triggerScenarios":"Any of the cap(ch)==5 worker slots or remaining tasks returns a non-nil error — e.g. CopyFile.Run() failing on a download/sha/upload error, or CopyImage.Run() failing to push an image — so gotError is true at copy.go:122.","commonSituations":"`kops get assets --copy` exits non-zero after a partial copy into a private S3/GCS repository; a flaky mirror caused 1 of 200 image pushes to fail; credentials allow read but not write to the target bucket.","solutions":["Scroll up in the kops output for the klog.Warning lines naming the specific failed asset(s).","Fix each underlying cause (network, credentials, sha mismatch) and re-run the copy command; already-copied assets are skipped via sha-file checks.","Verify write permissions on the target file repository/container registry.","Run with -v=4 or higher to see per-asset diagnostics (e.g. skipped sha matches)."],"exampleFix":"// before\nerror: not all assets copied successfully\n// after: find the detail line above it and fix, e.g.\nW s3://my-bucket/.../kubelet: unable to transfer ... : AccessDenied\n# grant s3:PutObject on the bucket, then re-run\nkops get assets --copy","handlingStrategy":"try-catch","validationCode":"// Ensure the target repository is writable before starting a long copy:\np := vfsContext.BuildVfsPath(fileRepository)\nprobe := fmt.Sprintf(\"%s/.write-probe\", fileRepository)\n// write and delete a small object to confirm PutObject/objects.create permission","typeGuard":null,"tryCatchPattern":"if err := assetcopy.Copy(...); err != nil {\n    if strings.Contains(err.Error(), \"not all assets copied successfully\") {\n        // scan captured klog warnings for the specific failed assets, then retry\n        return retryCopy(failedAssets)\n    }\n    return err\n}","preventionTips":["Grant write IAM permissions (s3:PutObject / storage.objects.create) on the target repository","Capture klog output so the per-asset detail lines are not lost","Copy in batches so one bad asset does not obscure others","Re-run the command; already-copied assets short-circuit via their .sha files"],"tags":["go","asset-copy","aggregate-error"],"backgroundTag":"not-all-assets-copied","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"}