JuliusBrussee/caveman · error

open sqlite %q: %w

Error message

open sqlite %q: %w

What it means

Error "open sqlite %q: %w" thrown in JuliusBrussee/caveman.

Source

Thrown at engine/ccr/store_sqlite.go:160

// handle.
func OpenWithBudget(path string, maxBytes int64) (*Store, error) {
	return openWithBudget(path, maxBytes, nil)
}

func openWithBudget(path string, maxBytes int64, afterPrepare func()) (*Store, error) {
	if maxBytes <= 0 {
		return nil, fmt.Errorf("ccr max storage bytes must be positive")
	}
	canonicalPath, err := PrepareSQLitePathCanonical(path)
	if err != nil {
		return nil, err
	}
	if afterPrepare != nil {
		afterPrepare()
	}
	db, err := sql.Open("sqlite", SQLiteDSN(canonicalPath))
	if err != nil {
		return nil, fmt.Errorf("open sqlite %q: %w", canonicalPath, err)
	}
	// One writer connection. With a single connection every statement serializes
	// in-process (no self-contention) while busy_timeout absorbs cross-process
	// contention; it is also mandatory for an in-memory DSN, where a second
	// pooled connection would be a second, empty database.
	db.SetMaxOpenConns(1)
	db.SetMaxIdleConns(1)
	if err := RetryOnBusy(func() error { _, e := db.Exec(schema); return e }); err != nil {
		_ = db.Close()
		return nil, fmt.Errorf("migrate sqlite %q: %w", canonicalPath, err)
	}
	if err := RetryOnBusy(func() error { return ensureMetadataColumn(db) }); err != nil {
		_ = db.Close()
		return nil, fmt.Errorf("migrate sqlite metadata %q: %w", canonicalPath, err)
	}
	if err := configureStorageBudget(db, maxBytes); err != nil {
		_ = db.Close()
		return nil, fmt.Errorf("configure sqlite storage budget %q: %w", canonicalPath, err)

View on GitHub (pinned to 27d5a3981a)

Solutions

  1. Fix the sqlite open error (path/permissions) and retry.

When it happens

Trigger: Thrown at engine/ccr/store_sqlite.go:160 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of JuliusBrussee/caveman@27d5a3981a (2026-08-15). Data as JSON: /api/errors/050949c7d7c0afbf. Report an issue: GitHub.