{"record":{"id":"6d3ace7221c417d1","repo":"weaviate/weaviate","slug":"get-files-w","errorCode":null,"errorMessage":"get files: %w","messagePattern":"get files: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"usecases/backup/backend.go","lineNumber":918,"sourceCode":"func (fw *fileWriter) WithPoolPercentage(p int) *fileWriter {\n\tfw.GoPoolSize = routinePoolSize(p)\n\treturn fw\n}\n\nfunc (fw *fileWriter) setMigrator(m func(classPath string) error) { fw.migrator = m }\n\n// Write downloads files into the staging directory. materializedName keys the\n// staging dir; it differs from desc.Name only under namespace-graduation\n// restore, where it must match the RAFT-applied RestoreClassDir lookup. Chunk\n// keys keep desc.Name — object-storage paths are immutable from upload.\nfunc (fw *fileWriter) Write(ctx context.Context, desc *backup.ClassDescriptor, materializedName, overrideBucket, overridePath string, compressionType backup.CompressionType) (err error) {\n\tif len(desc.Shards) == 0 { // nothing to copy\n\t\treturn nil\n\t}\n\tclassTempDir := path.Join(fw.tempDir, materializedName)\n\n\tif err := fw.writeTempFiles(ctx, classTempDir, overrideBucket, overridePath, desc, compressionType); err != nil {\n\t\treturn fmt.Errorf(\"get files: %w\", err)\n\t}\n\n\tif materializedName != desc.Name {\n\t\toldIndexDir := filepath.Join(classTempDir, strings.ToLower(desc.Name))\n\t\tnewIndexDir := filepath.Join(classTempDir, strings.ToLower(materializedName))\n\t\tif _, err := os.Stat(oldIndexDir); err == nil {\n\t\t\tif err := os.Rename(oldIndexDir, newIndexDir); err != nil {\n\t\t\t\treturn fmt.Errorf(\"rename strip index dir %s -> %s: %w\", oldIndexDir, newIndexDir, err)\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif fw.migrator != nil {\n\t\tif err := fw.migrator(classTempDir); err != nil {\n\t\t\treturn fmt.Errorf(\"migrate from pre 1.23: %w\", err)\n\t\t}\n\t}","sourceCodeStart":900,"sourceCodeEnd":936,"githubUrl":"https://github.com/weaviate/weaviate/blob/75aa4b6d11f8818305aafd4440b4e32794f7ca04/usecases/backup/backend.go#L900-L936","documentation":"Internal wrap produced by fileWriter.Write (usecases/backup/backend.go:918) when downloading a class's backup files into the staging (temp) directory fails during a backup restore. The wrapped error comes from writeTempFiles, which fans out concurrent chunk downloads from the backup backend (S3/GCS/Azure/filesystem) and unzips them. It signals that the class could not be fully staged, so the restore of this class is aborted and its temp files cleaned up.","triggerScenarios":"Calling the restore API (POST /backups/{backend}/{id}/restore) when any chunk download from the backup backend fails, the context is cancelled mid-download, decompression of a chunk fails, or incremental-backup chunk fetches (ReadFromOtherBackup) return an error.","commonSituations":"Backup bucket deleted or lifecycle-policy expired objects mid-restore; wrong or missing backend credentials; network interruption between Weaviate and object storage; backup made by an older Weaviate version with mismatched chunk layout; disk filling up on the node during staging.","solutions":["Check the wrapped (inner) error in the log to see whether the root cause is a backend read, unzip, or context cancellation, and fix that first.","Verify the backup still exists in the bucket and credentials/IAM permissions for the configured backend are valid.","Re-run the restore after confirming network connectivity to object storage and sufficient free disk space in the backing data path.","If the backup predates Weaviate 1.23, verify the migration path is supported or re-create the backup with a current version."],"exampleFix":"// before: restore fails with 'get files: read chunk <class>/chunk-0 from backend: object not found'\n// after: ensure the backup is complete before restoring\nstatus, _ := coordinator.GetStatus(ctx, backend, backupID)\nif status.Status != models.BackupStatusReady {\n    return fmt.Errorf(\"backup %s not ready\", backupID)\n}","handlingStrategy":"retry","validationCode":"status, err := client.Backup().GetRestoreStatus(ctx, backend, backupID)\nif err != nil {\n    return fmt.Errorf(\"cannot query backup %s: %w\", backupID, err)\n}\nif status.Status != models.BackupStatusSuccess {\n    return fmt.Errorf(\"backup %s not in SUCCESS state\", backupID)\n}","typeGuard":"func isStagingFailure(err error) bool {\n    return strings.Contains(err.Error(), \"get files:\")\n}","tryCatchPattern":"err := client.Backup().Restore(ctx, backend, backupID, withCfg)\nif err != nil {\n    var inner error\n    if errors.Unwrap(err) != nil { inner = errors.Unwrap(err) }\n    log.Printf(\"restore staging failed for %s: %v (root cause: %v)\", backupID, err, inner)\n    // inspect inner cause: backend read vs unzip vs ctx cancelled, fix, then retry\n}","preventionTips":["Verify backup status is SUCCESS before requesting a restore.","Confirm object-store credentials and bucket contents are valid before restoring.","Ensure nodes have sufficient free disk space for the staged copy of the class.","Avoid deleting backup buckets or applying aggressive lifecycle rules while restores may run."],"tags":["backup","restore","object-storage","go"],"backgroundTag":"backup-restore-staging-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"}