{"record":{"id":"97d8b29e0fefbdb3","repo":"plandex-ai/plandex","slug":"error-checking-lock-file-v","errorCode":null,"errorMessage":"error checking lock file: %v","messagePattern":"error checking lock file: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"app/server/db/git.go","lineNumber":562,"sourceCode":"\t\t\t// Combine header and message with a newline only if the message is not empty.\n\t\t\tfullEntry := header\n\t\t\tif message != \"\" {\n\t\t\t\tfullEntry += \"\\n\" + message\n\t\t\t}\n\n\t\t\thistory = append(history, [2]string{sha, fullEntry})\n\t\t}\n\t}\n\n\treturn history\n}\n\nfunc removeLockFile(lockFilePath string) error {\n\t_, err := os.Stat(lockFilePath)\n\texists := err == nil\n\t// log.Println(\"index.lock file exists:\", exists)\n\tif err != nil && !os.IsNotExist(err) {\n\t\treturn fmt.Errorf(\"error checking lock file: %v\", err)\n\t}\n\n\tattempts := 0\n\tfor exists {\n\t\tif attempts > 10 {\n\t\t\treturn fmt.Errorf(\"error removing index.lock file: %v after %d attempts\", err, attempts)\n\t\t}\n\n\t\tlog.Printf(\"[Git] removeLockFile - removing index.lock file: %s, attempt: %d\", lockFilePath, attempts)\n\n\t\tif err := os.Remove(lockFilePath); err != nil {\n\t\t\tif os.IsNotExist(err) {\n\t\t\t\tlog.Printf(\"[Git] removeLockFile - %s file not found, skipping removal\", lockFilePath)\n\t\t\t\treturn nil\n\t\t\t}\n\n\t\t\treturn fmt.Errorf(\"error removing lock file: %v\", err)\n\t\t}","sourceCodeStart":544,"sourceCodeEnd":580,"githubUrl":"https://github.com/plandex-ai/plandex/blob/e2d772072efadbe41d2946d97d79be55532dbab5/app/server/db/git.go#L544-L580","documentation":"Returned by removeLockFile when os.Stat on the git lock file path (index.lock) fails with an error other than os.IsNotExist. A non-existence error is expected and ignored; any other Stat failure (permission denied, I/O error, invalid path) means the lock file's presence cannot be determined, so no attempt is made to wait for or remove it.","triggerScenarios":"Thrown at app/server/db/git.go:562 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the wrapped error (permissions, I/O) on the repo path","Verify the process can stat files in the repo's .git dir","Retry after filesystem access is restored"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e2d772072efadbe41d2946d97d79be55532dbab5","analyzedAt":"2026-09-05T20:56:53.631Z","contentChangedAt":"2026-09-05T20:56:53.631Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}