{"record":{"id":"931e9f6f61139fa0","repo":"JuliusBrussee/caveman","slug":"resolve-sqlite-parent-q-w","errorCode":null,"errorMessage":"resolve sqlite parent %q: %w","messagePattern":"resolve sqlite parent %q: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"engine/ccr/store_sqlite.go","lineNumber":214,"sourceCode":"func PrepareSQLitePath(path string) error {\n\t_, err := PrepareSQLitePathCanonical(path)\n\treturn err\n}\n\n// PrepareSQLitePathCanonical secures path and returns the one canonical path\n// callers must use for every subsequent open and sidecar check. Returning the\n// resolved parent closes the check/use gap from a swappable parent symlink.\nfunc PrepareSQLitePathCanonical(path string) (string, error) {\n\tif path == \":memory:\" {\n\t\treturn path, nil\n\t}\n\tif strings.TrimSpace(path) == \"\" {\n\t\treturn \"\", fmt.Errorf(\"ccr sqlite path is required\")\n\t}\n\tparent := filepath.Dir(path)\n\tabsoluteParent, err := filepath.Abs(parent)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"resolve sqlite parent %q: %w\", parent, err)\n\t}\n\tresolvedParent, err := filepath.EvalSymlinks(absoluteParent)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"resolve sqlite parent %q: %w\", parent, err)\n\t}\n\tparentInfo, err := os.Stat(resolvedParent)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"inspect sqlite parent %q: %w\", resolvedParent, err)\n\t}\n\tif !parentInfo.IsDir() {\n\t\treturn \"\", fmt.Errorf(\"sqlite parent %q must be a directory\", resolvedParent)\n\t}\n\tif err := validateSQLiteParentSecurity(resolvedParent, parentInfo); err != nil {\n\t\treturn \"\", err\n\t}\n\tcanonicalPath := filepath.Join(resolvedParent, filepath.Base(path))\n\tif err := secureSQLiteFile(canonicalPath, true); err != nil {\n\t\treturn \"\", fmt.Errorf(\"secure sqlite %q: %w\", canonicalPath, err)","sourceCodeStart":196,"sourceCodeEnd":232,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/27d5a3981a347890211bb1bf2439e5c821a63bc9/engine/ccr/store_sqlite.go#L196-L232","documentation":"Error \"resolve sqlite parent %q: %w\" thrown in JuliusBrussee/caveman.","triggerScenarios":"Thrown at engine/ccr/store_sqlite.go:214 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix resolution of the sqlite parent directory."],"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"}