{"record":{"id":"a1f66198d8176de5","repo":"JuliusBrussee/caveman","slug":"refusing-non-regular-file","errorCode":null,"errorMessage":"refusing non-regular file","messagePattern":"refusing non-regular file","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"engine/ccr/store_sqlite.go","lineNumber":268,"sourceCode":"\tinfo, err := os.Lstat(path)\n\tif errors.Is(err, os.ErrNotExist) && create {\n\t\tfile, createErr := os.OpenFile(path, os.O_CREATE|os.O_EXCL|os.O_RDWR, 0o600)\n\t\tif createErr == nil {\n\t\t\treturn file.Close()\n\t\t}\n\t\tif !errors.Is(createErr, os.ErrExist) {\n\t\t\treturn createErr\n\t\t}\n\t\tinfo, err = os.Lstat(path)\n\t}\n\tif errors.Is(err, os.ErrNotExist) && !create {\n\t\treturn nil\n\t}\n\tif err != nil {\n\t\treturn err\n\t}\n\tif info.Mode()&os.ModeSymlink != 0 || !info.Mode().IsRegular() {\n\t\treturn fmt.Errorf(\"refusing non-regular file\")\n\t}\n\tfile, err := os.OpenFile(path, os.O_RDWR, 0)\n\tif errors.Is(err, os.ErrNotExist) && !create {\n\t\t// The sidecar vanished between Lstat and open — a concurrent process\n\t\t// checkpointed the WAL and removed it. Nothing left to secure.\n\t\treturn nil\n\t}\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer file.Close()\n\topened, err := file.Stat()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif !os.SameFile(info, opened) {\n\t\treturn fmt.Errorf(\"file changed while opening\")\n\t}","sourceCodeStart":250,"sourceCodeEnd":286,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/27d5a3981a347890211bb1bf2439e5c821a63bc9/engine/ccr/store_sqlite.go#L250-L286","documentation":"Error \"refusing non-regular file\" thrown in JuliusBrussee/caveman.","triggerScenarios":"Thrown at engine/ccr/store_sqlite.go:268 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Point the store at a regular file, not a symlink or device."],"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"}