{"record":{"id":"401adc9eb43e0dba","repo":"sipeed/picoclaw","slug":"failed-to-parse-session","errorCode":null,"errorMessage":"failed to parse session","messagePattern":"failed to parse session","errorType":"http","errorClass":null,"httpStatus":500,"severity":"error","filePath":"web/backend/api/session.go","lineNumber":935,"sourceCode":"\t\tsess, err = h.readJSONLSession(dir, ref.Key)\n\t}\n\tif err == nil && isEmptySession(sess) {\n\t\terr = os.ErrNotExist\n\t}\n\tif err != nil {\n\t\tif errors.Is(err, os.ErrNotExist) {\n\t\t\tif legacyRef, legacyErr := h.findLegacyPicoSession(dir, sessionID); legacyErr == nil {\n\t\t\t\tsess, err = h.readLegacySession(legacyRef.Path)\n\t\t\t}\n\t\t\tif err == nil && isEmptySession(sess) {\n\t\t\t\terr = os.ErrNotExist\n\t\t\t}\n\t\t}\n\t\tif err != nil {\n\t\t\tif errors.Is(err, os.ErrNotExist) {\n\t\t\t\thttp.Error(w, \"session not found\", http.StatusNotFound)\n\t\t\t} else {\n\t\t\t\thttp.Error(w, \"failed to parse session\", http.StatusInternalServerError)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t}\n\n\tfor i := range sess.Messages {\n\t\tif sess.Messages[i].CreatedAt == nil {\n\t\t\tsess.Messages[i].CreatedAt = &sess.Updated\n\t\t}\n\t}\n\tmessages := detailSessionMessages(sess.Messages, toolFeedbackMaxArgsLength)\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tjson.NewEncoder(w).Encode(map[string]any{\n\t\t\"id\":       sessionID,\n\t\t\"messages\": messages,\n\t\t\"summary\":  sess.Summary,\n\t\t\"created\":  sess.Created.Format(time.RFC3339),","sourceCodeStart":917,"sourceCodeEnd":953,"githubUrl":"https://github.com/sipeed/picoclaw/blob/49183d7e8daed0dba89ddbb6fcb60089401d9680/web/backend/api/session.go#L917-L953","documentation":"Sent as a 500 by handleGetSession when the session file exists but could not be read or parsed (readJSONLSession/readLegacySession returned a non-ErrNotExist error). Indicates a corrupt or unreadable session file rather than a missing one.","triggerScenarios":"Thrown at web/backend/api/session.go:935 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the session's .jsonl/.meta.json files for corruption or invalid JSON","Verify file read permissions for the backend process","Restore the session file from backup or remove the corrupt file"],"exampleFix":null,"handlingStrategy":"fallback","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"}