wavetermdev/waveterm · error
error getting data parts: %w
Error message
error getting data parts: %w
What it means
loadDataPartsIntoCache fetches the required data parts for an entry from the DB via dbGetFileParts. If that bulk lookup fails, the error is wrapped as 'error getting data parts: %w' and the entry's data cache is left partially unpopulated.
Source
Thrown at pkg/filestore/blockstore_cache.go:281
var rtn []int
for _, partIdx := range parts {
if dataEntries[partIdx] != nil {
continue
}
rtn = append(rtn, partIdx)
}
return rtn
}
func (entry *CacheEntry) loadDataPartsIntoCache(ctx context.Context, parts []int) error {
parts = prunePartsWithCache(entry.DataEntries, parts)
if len(parts) == 0 {
// parts are already loaded
return nil
}
dbDataParts, err := dbGetFileParts(ctx, entry.ZoneId, entry.Name, parts)
if err != nil {
return fmt.Errorf("error getting data parts: %w", err)
}
for partIdx, dce := range dbDataParts {
entry.DataEntries[partIdx] = dce
}
return nil
}
func (entry *CacheEntry) loadDataPartsForRead(ctx context.Context, parts []int) (map[int]*DataCacheEntry, error) {
if len(parts) == 0 {
return nil, nil
}
dbParts := prunePartsWithCache(entry.DataEntries, parts)
var dbDataParts map[int]*DataCacheEntry
if len(dbParts) > 0 {
var err error
dbDataParts, err = dbGetFileParts(ctx, entry.ZoneId, entry.Name, dbParts)
if err != nil {
return nil, fmt.Errorf("error getting data parts: %w", err)View on GitHub (pinned to a4447c1563)
Solutions
- Unwrap the error to find the driver-level cause (connection, timeout, permissions).
- Retry the operation once DB connectivity is restored; the parts lookup is idempotent.
- Verify DB schema/migrations for the file-parts table and check part indices for corruption.
Example fix
// before
_, data, err := fs.ReadAt(ctx, zone, name, 0, size)
if err != nil { return err }
// after
_, data, err := fs.ReadAt(ctx, zone, name, 0, size)
if err != nil && strings.Contains(err.Error(), "error getting data parts") {
return retryWithBackoff(3, func() error { _, _, err = fs.ReadAt(ctx, zone, name, 0, size); return err })
} Defensive patterns
Strategy: retry
Try / catch
_, data, err := fs.ReadAt(ctx, zone, name, off, n)
if err != nil && strings.Contains(err.Error(), "error getting data parts") {
return retryWithBackoff(3, time.Second, func() error {
_, data, err = fs.ReadAt(ctx, zone, name, off, n)
return err
})
} Prevention
- Add retry with backoff for transient DB failures on part loads.
- Monitor DB availability; part fetches fail hard when the DB is down.
- Keep part-table schema migrations current to avoid lookup errors.
When it happens
Trigger: WriteAt, ReadAt, or compaction paths that call loadDataPartsIntoCache with parts missing from the in-memory cache, when dbGetFileParts hits a DB error (connectivity, missing rows, query failure).
Common situations: Database restarts or network blips during reads/writes; DB schema drift or corruption so part rows are unreadable; very large part batches timing out.
Related errors
- error deleting file: %v
- error getting zone files: %v
- error getting file: %v
- error flushing cache entry[%v]: %v
- error getting file: %w
AI-assisted analysis of wavetermdev/waveterm@a4447c1563 (2026-09-01).
Data as JSON: /api/errors/aedffbf3bfc03f93.
Report an issue: GitHub.