JuliusBrussee/caveman · error
create
Error message
create %s: %w
What it means
After resolving the home directory, defaultCCRPath ensures the directory exists with os.MkdirAll(home, 0o700); if that mkdir fails the error is wrapped as 'create <path>'. This guarantees the ~/.caveman (or CAVEMAN_HOME) directory exists before placing ccr.db in it.
Solutions
- Check what occupies the path: if a regular file exists at the target, remove or rename it
- Point CAVEMAN_HOME at a writable directory (`mkdir -p /var/lib/caveman && export CAVEMAN_HOME=/var/lib/caveman`)
- Fix permissions on the parent directory (chmod/chown) or run as the owning user
- Set CAVEMAN_CCR_DB directly to bypass home-directory creation
Example fix
// before export CAVEMAN_HOME=/mnt/readonly/volume // after export CAVEMAN_HOME=$HOME/.caveman && mkdir -p $HOME/.caveman
Defensive patterns
Strategy: try-catch
Validate before calling
home := os.Getenv("CAVEMAN_HOME")
if home == "" { home = filepath.Join(os.Getenv("HOME"), ".caveman") }
if fi, err := os.Stat(home); err == nil && !fi.IsDir() {
return fmt.Errorf("%s exists but is not a directory", home)
}
if err := unix.Access(filepath.Dir(home), unix.W_OK); err != nil { /* parent not writable */ } Try / catch
path, err := defaultCCRPath()
if err != nil {
if strings.Contains(err.Error(), "create ") {
// surface hint: check CAVEMAN_HOME writability / stray file
}
return err
} Prevention
- Ensure the CAVEMAN_HOME target is a writable directory, not a file or read-only mount
- Pre-create the directory in Dockerfiles with correct ownership
- Never point CAVEMAN_HOME at /proc, /sys, or read-only volumes
When it happens
Trigger: CAVEMAN_HOME (or the derived ~/.caveman) points somewhere non-writable or is blocked by an existing non-directory file: read-only filesystem, permission-denied parent, a regular file already occupying the path, or a full disk.
Common situations: Pointing CAVEMAN_HOME at /proc, /sys or a read-only mount; a stray file named `.caveman` in the home directory; running in a sandbox that blocks filesystem writes; NFS/EFS permission issues.
Understand the failure class
Background: mkdir permission denied (EACCES): failed to create directory errors explained — this error's family across 32 libraries.
Related errors
- native runtime mkdir
- cannot persist MCP ownership journal at
- create recovery directory
- create
- native runtime chmod dir
AI-assisted analysis of JuliusBrussee/caveman@3ee70a1026 (2026-09-20).
Data as JSON: /api/errors/b3b466598944b879.
Report an issue: GitHub.
Appendix: source
Thrown at shrink/shrink.go:92
// defaultCCRPath resolves the durable shared recovery store path, mirroring the
// engine CLI, MCP server, and proxy: CAVEMAN_CCR_DB, else CAVEMAN_HOME/ccr.db,
// else ~/.caveman/ccr.db. It creates the parent directory so the first shrink on a
// machine succeeds.
func defaultCCRPath() (string, error) {
if p := os.Getenv("CAVEMAN_CCR_DB"); p != "" {
return p, nil
}
home := os.Getenv("CAVEMAN_HOME")
if home == "" {
h, err := os.UserHomeDir()
if err != nil {
return "", fmt.Errorf("resolve home directory: %w", err)
}
home = filepath.Join(h, ".caveman")
}
if err := os.MkdirAll(home, 0o700); err != nil {
return "", fmt.Errorf("create %s: %w", home, err)
}
return filepath.Join(home, "ccr.db"), nil
}
// Result is the outcome of Shrink.
type Result struct {
Output []byte `json:"-"`
TokensBefore int `json:"tokens_before"`
TokensAfter int `json:"tokens_after"`
Ratio float64 `json:"ratio"`
Basis string `json:"basis"`
ContentType string `json:"content_type"`
RecoveryHandle string `json:"recovery_handle,omitempty"`
}
// Shrink compresses a tool catalog with an S4 lossy transform. It is fail-open:
// on any parse problem or when the result would not be smaller, it returns the
// input unchanged with ratio 0 and no handle.View on GitHub (pinned to 3ee70a1026)