{"record":{"id":"75ef2e5cb9326667","repo":"sipeed/picoclaw","slug":"failed-to-delete-session","errorCode":null,"errorMessage":"failed to delete session","messagePattern":"failed to delete session","errorType":"http","errorClass":null,"httpStatus":500,"severity":"error","filePath":"web/backend/api/session.go","lineNumber":982,"sourceCode":"\t\thttp.Error(w, \"missing session id\", http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tdir, err := h.sessionsDir()\n\tif err != nil {\n\t\thttp.Error(w, \"failed to resolve sessions directory\", http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tremoved := false\n\tif ref, err := h.findPicoJSONLSession(dir, sessionID); err == nil {\n\t\tbase := filepath.Join(dir, sanitizeSessionKey(ref.Key))\n\t\tfor _, path := range []string{base + \".jsonl\", base + \".meta.json\"} {\n\t\t\tif err := os.Remove(path); err != nil {\n\t\t\t\tif os.IsNotExist(err) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\thttp.Error(w, \"failed to delete session\", http.StatusInternalServerError)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tremoved = true\n\t\t}\n\t}\n\n\tif legacyRef, err := h.findLegacyPicoSession(dir, sessionID); err == nil {\n\t\tif err := os.Remove(legacyRef.Path); err != nil {\n\t\t\tif !os.IsNotExist(err) {\n\t\t\t\thttp.Error(w, \"failed to delete session\", http.StatusInternalServerError)\n\t\t\t\treturn\n\t\t\t}\n\t\t} else {\n\t\t\tremoved = true\n\t\t}\n\t}\n\n\tif !removed {","sourceCodeStart":964,"sourceCodeEnd":1000,"githubUrl":"https://github.com/sipeed/picoclaw/blob/49183d7e8daed0dba89ddbb6fcb60089401d9680/web/backend/api/session.go#L964-L1000","documentation":"Sent as a 500 by handleDeleteSession when os.Remove fails on a session's .jsonl or .meta.json file with an error other than NotExist (e.g. permission denied). NotExist errors are skipped; this fires only for real deletion failures.","triggerScenarios":"Thrown at web/backend/api/session.go:982 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check backend logs for the underlying os.Remove error","Verify the backend has delete permissions on the sessions directory","Remove the offending files manually and retry the delete"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"49183d7e8daed0dba89ddbb6fcb60089401d9680","analyzedAt":"2026-08-15T21:55:41.315Z","contentChangedAt":"2026-08-15T21:55:41.315Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}