{"record":{"id":"44e351f05ea14bc8","repo":"plandex-ai/plandex","slug":"error-removing-index-lock-file-v-after-d-attemp","errorCode":null,"errorMessage":"error removing index.lock file: %v after %d attempts","messagePattern":"error removing index\\.lock file: (.+?) after (.+?) attempts","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"app/server/db/git.go","lineNumber":568,"sourceCode":"\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}\n\n\t\t_, err = os.Stat(lockFilePath)\n\t\texists = err == nil\n\n\t\tif err != nil && !os.IsNotExist(err) {\n\t\t\treturn fmt.Errorf(\"error checking lock file: %v\", err)","sourceCodeStart":550,"sourceCodeEnd":586,"githubUrl":"https://github.com/plandex-ai/plandex/blob/e2d772072efadbe41d2946d97d79be55532dbab5/app/server/db/git.go#L550-L586","documentation":"removeLockFile exhausted its 10 attempts (with backoff) trying to delete a lingering git index.lock that still exists. The lock is being held/recreated by a concurrent git process, or deletion keeps failing (permissions).","triggerScenarios":"Thrown at app/server/db/git.go:568 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check no other git process is running against the repo","Inspect permissions on the index.lock file","Manually remove the stale lock if no git process holds it, then retry"],"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-12T22:17:10.623Z"}