{"record":{"id":"dd5bfa5e4329ffe5","repo":"weaviate/weaviate","slug":"write-files-for-shard-q-w","errorCode":null,"errorMessage":"write files for shard %q: %w","messagePattern":"write files for shard %q: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"usecases/backup/backend.go","lineNumber":721,"sourceCode":"\t\t}()\n\n\t\tif err := ctx.Err(); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tvar fileSizeExceededInfo *SplitFile\n\t\tif fileSizeExceededWrite != nil {\n\t\t\t// Only write the split file part in this chunk; remaining space is intentionally\n\t\t\t// left unused to keep the logic simple and avoid mixing split file parts with\n\t\t\t// regular files in the same chunk.\n\t\t\tfileSizeExceededInfo, err = zip.WriteSplitFile(ctx, shard, fileSizeExceededWrite, &preCompressionSize, chunkKey)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"write split file for shard %q: %w\", shard.Name, err)\n\t\t\t}\n\t\t} else {\n\t\t\t_, fileSizeExceededInfo, err = zip.WriteShard(ctx, shard, filesInShard, firstChunkForShard, &preCompressionSize, chunkKey)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"write files for shard %q: %w\", shard.Name, err)\n\t\t\t}\n\t\t}\n\t\tshard.ClearTemporary()\n\n\t\tif zip.compressorWriter != nil {\n\t\t\tif err := zip.compressorWriter.Flush(); err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"flush compressor: %w\", err)\n\t\t\t}\n\t\t}\n\n\t\treturn fileSizeExceededInfo, nil\n\t}\n\n\t// consumer\n\teg.Go(func() error {\n\t\tif _, err := u.backend.Write(ctx, chunkKey, overrideBucket, overridePath, reader); err != nil {\n\t\t\tu.log.WithFields(logrus.Fields{\n\t\t\t\t\"chunkKey\": chunkKey,","sourceCodeStart":703,"sourceCodeEnd":739,"githubUrl":"https://github.com/weaviate/weaviate/blob/75aa4b6d11f8818305aafd4440b4e32794f7ca04/usecases/backup/backend.go#L703-L739","documentation":"Wraps a failure from zip.WriteShard, which packages a shard's files into a zip chunk for upload. This is the normal (non-split) path of per-shard backup writing; any read/compress/write failure while packaging shard files surfaces with the shard name attached.","triggerScenarios":"Backup create API on a shard whose files are read, zipped, and written via WriteShard and the write fails — file disappeared mid-read, corrupt file, or destination write error.","commonSituations":"Backing up while the underlying shard data path is modified (torn read), disk errors on the source, or destination backend rejecting the chunk (S3 5xx, permissions, exhausted space).","solutions":["Read the wrapped inner error to distinguish source-read vs destination-write failure.","Retry the backup after confirming no competing process is mutating the shard's staging files.","Check destination bucket permissions/quota and network stability.","Check disk health on the node hosting the shard (dmesg, SMART) if inner error indicates I/O errors."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// preflight destination write probe\nif err := probeDestinationWrite(bucket); err != nil {\n    return fmt.Errorf(\"destination not writable: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"if err := runBackup(ctx); err != nil {\n    var netErr net.Error\n    if strings.Contains(err.Error(), \"write files for shard\") && errors.As(err, &netErr) {\n        err = runBackup(ctx) // transient destination error, retry\n    }\n}","preventionTips":["Avoid mutating collections heavily during backups.","Check destination bucket health/permissions before large backups.","Watch node disk health for source-read failures."],"tags":["backup","zip","shard"],"backgroundTag":"shard-write-failed","analyzedSha":"75aa4b6d11f8818305aafd4440b4e32794f7ca04","analyzedAt":"2026-09-04T14:58:20.392Z","contentChangedAt":"2026-09-04T14:58:20.392Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}