weaviate/weaviate · error

get files: %w

Error message

get files: %w

What it means

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.

Source

Thrown at usecases/backup/backend.go:918

func (fw *fileWriter) WithPoolPercentage(p int) *fileWriter {
	fw.GoPoolSize = routinePoolSize(p)
	return fw
}

func (fw *fileWriter) setMigrator(m func(classPath string) error) { fw.migrator = m }

// Write downloads files into the staging directory. materializedName keys the
// staging dir; it differs from desc.Name only under namespace-graduation
// restore, where it must match the RAFT-applied RestoreClassDir lookup. Chunk
// keys keep desc.Name — object-storage paths are immutable from upload.
func (fw *fileWriter) Write(ctx context.Context, desc *backup.ClassDescriptor, materializedName, overrideBucket, overridePath string, compressionType backup.CompressionType) (err error) {
	if len(desc.Shards) == 0 { // nothing to copy
		return nil
	}
	classTempDir := path.Join(fw.tempDir, materializedName)

	if err := fw.writeTempFiles(ctx, classTempDir, overrideBucket, overridePath, desc, compressionType); err != nil {
		return fmt.Errorf("get files: %w", err)
	}

	if materializedName != desc.Name {
		oldIndexDir := filepath.Join(classTempDir, strings.ToLower(desc.Name))
		newIndexDir := filepath.Join(classTempDir, strings.ToLower(materializedName))
		if _, err := os.Stat(oldIndexDir); err == nil {
			if err := os.Rename(oldIndexDir, newIndexDir); err != nil {
				return fmt.Errorf("rename strip index dir %s -> %s: %w", oldIndexDir, newIndexDir, err)
			}
		}

	}

	if fw.migrator != nil {
		if err := fw.migrator(classTempDir); err != nil {
			return fmt.Errorf("migrate from pre 1.23: %w", err)
		}
	}

View on GitHub (pinned to 75aa4b6d11)

Solutions

  1. 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.
  2. Verify the backup still exists in the bucket and credentials/IAM permissions for the configured backend are valid.
  3. Re-run the restore after confirming network connectivity to object storage and sufficient free disk space in the backing data path.
  4. If the backup predates Weaviate 1.23, verify the migration path is supported or re-create the backup with a current version.

Example fix

// before: restore fails with 'get files: read chunk <class>/chunk-0 from backend: object not found'
// after: ensure the backup is complete before restoring
status, _ := coordinator.GetStatus(ctx, backend, backupID)
if status.Status != models.BackupStatusReady {
    return fmt.Errorf("backup %s not ready", backupID)
}
Defensive patterns

Strategy: retry

Validate before calling

status, err := client.Backup().GetRestoreStatus(ctx, backend, backupID)
if err != nil {
    return fmt.Errorf("cannot query backup %s: %w", backupID, err)
}
if status.Status != models.BackupStatusSuccess {
    return fmt.Errorf("backup %s not in SUCCESS state", backupID)
}

Type guard

func isStagingFailure(err error) bool {
    return strings.Contains(err.Error(), "get files:")
}

Try / catch

err := client.Backup().Restore(ctx, backend, backupID, withCfg)
if err != nil {
    var inner error
    if errors.Unwrap(err) != nil { inner = errors.Unwrap(err) }
    log.Printf("restore staging failed for %s: %v (root cause: %v)", backupID, err, inner)
    // inspect inner cause: backend read vs unzip vs ctx cancelled, fix, then retry
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of weaviate/weaviate@75aa4b6d11 (2026-09-04). Data as JSON: /api/errors/6d3ace7221c417d1. Report an issue: GitHub.