{"record":{"id":"07ff769e0fb86160","repo":"JuliusBrussee/caveman","slug":"resolve-home-directory-w","errorCode":null,"errorMessage":"resolve home directory: %w","messagePattern":"resolve home directory: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"shrink/shrink.go","lineNumber":87,"sourceCode":"\tif err != nil {\n\t\treturn nil, nil, fmt.Errorf(\"open recovery store %q: %w\", path, err)\n\t}\n\treturn s, s.Close, nil\n}\n\n// defaultCCRPath resolves the durable shared recovery store path, mirroring the\n// engine CLI, MCP server, and proxy: CAVEMAN_CCR_DB, else CAVEMAN_HOME/ccr.db,\n// else ~/.caveman/ccr.db. It creates the parent directory so the first shrink on a\n// machine succeeds.\nfunc defaultCCRPath() (string, error) {\n\tif p := os.Getenv(\"CAVEMAN_CCR_DB\"); p != \"\" {\n\t\treturn p, nil\n\t}\n\thome := os.Getenv(\"CAVEMAN_HOME\")\n\tif home == \"\" {\n\t\th, err := os.UserHomeDir()\n\t\tif err != nil {\n\t\t\treturn \"\", fmt.Errorf(\"resolve home directory: %w\", err)\n\t\t}\n\t\thome = filepath.Join(h, \".caveman\")\n\t}\n\tif err := os.MkdirAll(home, 0o700); err != nil {\n\t\treturn \"\", fmt.Errorf(\"create %s: %w\", home, err)\n\t}\n\treturn filepath.Join(home, \"ccr.db\"), nil\n}\n\n// Result is the outcome of Shrink.\ntype Result struct {\n\tOutput         []byte  `json:\"-\"`\n\tTokensBefore   int     `json:\"tokens_before\"`\n\tTokensAfter    int     `json:\"tokens_after\"`\n\tRatio          float64 `json:\"ratio\"`\n\tBasis          string  `json:\"basis\"`\n\tContentType    string  `json:\"content_type\"`\n\tRecoveryHandle string  `json:\"recovery_handle,omitempty\"`","sourceCodeStart":69,"sourceCodeEnd":105,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/27d5a3981a347890211bb1bf2439e5c821a63bc9/shrink/shrink.go#L69-L105","documentation":"Error \"resolve home directory: %w\" thrown in JuliusBrussee/caveman.","triggerScenarios":"Thrown at shrink/shrink.go:87 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix home directory resolution (set HOME) and retry."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"27d5a3981a347890211bb1bf2439e5c821a63bc9","analyzedAt":"2026-08-15T09:26:11.751Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}