{"record":{"id":"184351704fd8070e","repo":"kubernetes/kops","slug":"error-writing-s-v-184351","errorCode":null,"errorMessage":"error writing %s: %v","messagePattern":"error writing (.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"util/pkg/vfs/gsfs.go","lineNumber":211,"sourceCode":"\t\t\tklog.V(4).Infof(\"Writing file %q\", p)\n\t\t}\n\n\t\tif _, err := data.Seek(0, 0); err != nil {\n\t\t\treturn false, fmt.Errorf(\"error seeking to start of data stream for write to %s: %v\", p, err)\n\t\t}\n\n\t\tclient, err := p.getStorageClient(ctx)\n\t\tif err != nil {\n\t\t\treturn false, err\n\t\t}\n\n\t\tw := client.Bucket(p.bucket).Object(p.key).NewWriter(ctx)\n\t\t// The upload is rejected if the data does not match this MD5 hash\n\t\tw.MD5 = md5Hash.HashValue\n\t\tw.ACL = objectACL\n\t\tif _, err := io.Copy(w, data); err != nil {\n\t\t\tw.Close()\n\t\t\treturn false, fmt.Errorf(\"error writing %s: %v\", p, err)\n\t\t}\n\t\tif err := w.Close(); err != nil {\n\t\t\treturn false, fmt.Errorf(\"error writing %s: %v\", p, err)\n\t\t}\n\n\t\treturn true, nil\n\t})\n\tif err != nil {\n\t\treturn err\n\t} else if done {\n\t\treturn nil\n\t} else {\n\t\t// Shouldn't happen - we always return a non-nil error with false\n\t\treturn wait.ErrWaitTimeout\n\t}\n}\n\n// To prevent concurrent creates on the same file while maintaining atomicity of writes,","sourceCodeStart":193,"sourceCodeEnd":229,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/util/pkg/vfs/gsfs.go#L193-L229","documentation":"Returned when io.Copy from the source data stream into the GCS object writer fails during a WriteFile on a GSPath. The copy can fail because the source reader errors mid-stream, the network connection to GCS drops, or the uploaded bytes do not match the MD5 hash set on the writer (GCS rejects the upload). The writer is closed before returning so the partial upload is finalized or discarded by the SDK.","triggerScenarios":"Thrown at util/pkg/vfs/gsfs.go:211 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the underlying error: an MD5 mismatch means the data stream changed between hashing and upload — regenerate the hash from the same seek position before retrying","Verify network connectivity and GCS permissions (storage.objects.create on the bucket)","Ensure the data io.ReadSeeker is fully populated before the write; re-seek to 0 and retry once on transient network errors"],"exampleFix":null,"handlingStrategy":"retry","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"}