JuliusBrussee/caveman · error
ccr get
Error message
ccr get: %w
What it means
Wraps the recoveries-table SELECT failure in Store.Get for a non-object handle. It is not the not-found case (that returns ErrNotFound); it means the query itself failed — locked database, corrupted file, or driver error.
Solutions
- Check the wrapped error for lock/corruption causes
- Retry the retrieval once transient locks clear
- If the database is corrupt, restore from backup or accept the loss (recovery data is derived)
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at engine/ccr/store_sqlite.go:464 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of JuliusBrussee/caveman@766dce6b13 (2026-08-18).
Data as JSON: /api/errors/d4dcb5ccf0a44417.
Report an issue: GitHub.
Appendix: source
Thrown at engine/ccr/store_sqlite.go:464
return strings.Contains(text, "database or disk is full") || strings.Contains(text, "sqlite_full")
}
// Get returns the exact original bytes for a handle, or ErrNotFound.
func (s *Store) Get(handle string) ([]byte, error) {
if strings.HasPrefix(handle, "ccr_obj_") {
obj, err := s.GetObject(handle)
if err != nil {
return nil, err
}
return append([]byte(nil), obj.Data...), nil
}
var original []byte
row := s.db.QueryRow(`SELECT original FROM recoveries WHERE handle = ?`, handle)
switch err := row.Scan(&original); {
case errors.Is(err, sql.ErrNoRows):
return nil, ErrNotFound
case err != nil:
return nil, fmt.Errorf("ccr get: %w", err)
}
return original, nil
}
// GetMetadata returns optional compressor metadata stored with a handle. A known
// handle with no metadata returns nil, nil; an unknown handle returns ErrNotFound.
func (s *Store) GetMetadata(handle string) ([]byte, error) {
if strings.HasPrefix(handle, "ccr_obj_") {
if _, err := s.GetObject(handle); err != nil {
return nil, err
}
return nil, nil
}
var metadata []byte
row := s.db.QueryRow(`SELECT metadata FROM recoveries WHERE handle = ?`, handle)
switch err := row.Scan(&metadata); {
case errors.Is(err, sql.ErrNoRows):
return nil, ErrNotFoundView on GitHub (pinned to 766dce6b13)