JuliusBrussee/caveman · error

create %s: %w

Error message

create %s: %w

What it means

Error "create %s: %w" thrown in JuliusBrussee/caveman.

Source

Thrown at mem/store.go:102

// Options configures Open.
type Options struct {
	// Dir is the data directory; default ~/.caveman/mem (honoring CAVEMAN_HOME).
	Dir string
	// InMemory uses an ephemeral database for both memories and CCR (tests).
	InMemory bool
}

// Open opens (creating if needed) a cavemem store.
func Open(opts Options) (*Store, error) {
	memPath, ccrPath := ":memory:", ":memory:"
	if !opts.InMemory {
		dir := opts.Dir
		if dir == "" {
			dir = defaultDir()
		}
		if err := os.MkdirAll(dir, 0o700); err != nil {
			return nil, fmt.Errorf("create %s: %w", dir, err)
		}
		memPath = filepath.Join(dir, "mem.db")
		ccrPath = filepath.Join(dir, "ccr.db")
	}
	canonicalMemPath, err := ccr.PrepareSQLitePathCanonical(memPath)
	if err != nil {
		return nil, fmt.Errorf("secure memories db: %w", err)
	}
	// Same embedded-SQLite-behind-a-multi-process-CLI discipline as the recovery
	// store: a single writer connection plus busy_timeout(5000)+WAL. Several
	// cavemem processes (and the MCP server) share one mem.db, and the JS client
	// fires Promise.all(facts.map(remember)); without this, concurrent writes
	// returned SQLITE_BUSY and were silently dropped. See ccr.SQLiteDSN.
	db, err := sql.Open("sqlite", ccr.SQLiteDSN(canonicalMemPath))
	if err != nil {
		return nil, fmt.Errorf("open memories db: %w", err)
	}
	db.SetMaxOpenConns(1)

View on GitHub (pinned to 27d5a3981a)

Solutions

  1. Fix directory creation (path/permissions) and retry.

When it happens

Trigger: Thrown at mem/store.go:102 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/93047b7bbc6796a7. Report an issue: GitHub.