chenhg5/cc-connect · error

cursor: read chats dir

Error message

cursor: read chats dir %s: %w

What it means

Wraps a failed os.ReadDir of a Cursor chats directory during session listing. Missing directories are skipped; this error fires only on other IO failures such as permission denial while scanning one of the known chats locations for the workspace.

Solutions

  1. Fix read permissions on the Cursor chats directories
  2. Check for filesystem errors on the affected path
  3. Retry /sessions after repair
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at agent/cursor/cursor.go:420 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of chenhg5/cc-connect@4000b2338a (2026-09-06). Data as JSON: /api/errors/c3f3a8d2cc4191a7. Report an issue: GitHub.

Appendix: source

Thrown at agent/cursor/cursor.go:420

func listCursorSessions(workDir string) ([]core.AgentSessionInfo, error) {
	homeDir, err := os.UserHomeDir()
	if err != nil {
		return nil, fmt.Errorf("cursor: cannot determine home dir: %w", err)
	}

	chatsDirs := workspaceChatsDirs(homeDir, workDir)
	if len(chatsDirs) == 0 {
		return nil, nil
	}

	byID := make(map[string]core.AgentSessionInfo)
	for _, chatsDir := range chatsDirs {
		entries, err := os.ReadDir(chatsDir)
		if err != nil {
			if os.IsNotExist(err) {
				continue
			}
			return nil, fmt.Errorf("cursor: read chats dir %s: %w", chatsDir, err)
		}

		for _, entry := range entries {
			if !entry.IsDir() {
				continue
			}
			sessionID := entry.Name()
			dbPath := filepath.Join(chatsDir, sessionID, "store.db")
			if _, err := os.Stat(dbPath); err != nil {
				continue
			}

			info, err := entry.Info()
			if err != nil {
				continue
			}

			meta := readSessionMeta(dbPath)

View on GitHub (pinned to 4000b2338a)