{"record":{"id":"a4a6d2a499ab353f","repo":"sipeed/picoclaw","slug":"failed-to-resolve-sessions-directory","errorCode":null,"errorMessage":"failed to resolve sessions directory","messagePattern":"failed to resolve sessions directory","errorType":"http","errorClass":null,"httpStatus":500,"severity":"error","filePath":"web/backend/api/session.go","lineNumber":823,"sourceCode":"\tif len(workspace) > 0 && workspace[0] == '~' {\n\t\thome, _ := os.UserHomeDir()\n\t\tif len(workspace) > 1 && workspace[1] == '/' {\n\t\t\tworkspace = home + workspace[1:]\n\t\t} else {\n\t\t\tworkspace = home\n\t\t}\n\t}\n\n\treturn filepath.Join(workspace, \"sessions\")\n}\n\n// handleListSessions returns a list of Pico session summaries.\n//\n//\tGET /api/sessions\nfunc (h *Handler) handleListSessions(w http.ResponseWriter, r *http.Request) {\n\tdir, toolFeedbackMaxArgsLength, err := h.sessionRuntimeSettings()\n\tif err != nil {\n\t\thttp.Error(w, \"failed to resolve sessions directory\", http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tif _, err := os.ReadDir(dir); err != nil {\n\t\t// Directory doesn't exist yet = no sessions\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tjson.NewEncoder(w).Encode([]sessionListItem{})\n\t\treturn\n\t}\n\n\titems := []sessionListItem{}\n\tseen := make(map[string]struct{})\n\n\tif refs, findErr := h.findPicoJSONLSessions(dir); findErr == nil {\n\t\tfor _, ref := range refs {\n\t\t\tsess, loadErr := h.readJSONLSession(dir, ref.Key)\n\t\t\tif loadErr != nil || isEmptySession(sess) {\n\t\t\t\tcontinue","sourceCodeStart":805,"sourceCodeEnd":841,"githubUrl":"https://github.com/sipeed/picoclaw/blob/49183d7e8daed0dba89ddbb6fcb60089401d9680/web/backend/api/session.go#L805-L841","documentation":"Error \"failed to resolve sessions directory\" thrown in sipeed/picoclaw.","triggerScenarios":"Thrown at web/backend/api/session.go:823 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"49183d7e8daed0dba89ddbb6fcb60089401d9680","analyzedAt":"2026-08-15T21:55:41.315Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}