{"record":{"id":"b3b466598944b879","repo":"JuliusBrussee/caveman","slug":"create-s-w-b3b466","errorCode":null,"errorMessage":"create %s: %w","messagePattern":"create (.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"shrink/shrink.go","lineNumber":92,"sourceCode":"\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\"`\n}\n\n// Shrink compresses a tool catalog with an S4 lossy transform. It is fail-open:\n// on any parse problem or when the result would not be smaller, it returns the\n// input unchanged with ratio 0 and no handle.","sourceCodeStart":74,"sourceCodeEnd":110,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/27d5a3981a347890211bb1bf2439e5c821a63bc9/shrink/shrink.go#L74-L110","documentation":"Error \"create %s: %w\" thrown in JuliusBrussee/caveman.","triggerScenarios":"Thrown at shrink/shrink.go:92 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix directory creation (path/permissions) 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-15T22:17:37.221Z"}