chenhg5/cc-connect · error

cursor: cannot determine home dir: %w

Error message

cursor: cannot determine home dir: %w

What it means

Wraps a failed os.UserHomeDir() inside cursor Agent.DeleteSession. Cursor chat storage lives under the home directory (~/.cursor/chats or ~/.config/Cursor/chats); without a home the path cannot be built and deletion aborts.

Source

Thrown at agent/cursor/cursor.go:223

		}
	}
	a.mu.RUnlock()

	return newCursorSession(ctx, cmd, extraArgs, workDir, model, mode, sessionID, extraEnv)
}

// ListSessions reads sessions from Cursor Agent CLI chat storage.
// The CLI may store chats under ~/.cursor/chats or ~/.config/Cursor/chats
// depending on XDG_CONFIG_HOME and platform; all known locations are scanned.
func (a *Agent) ListSessions(_ context.Context) ([]core.AgentSessionInfo, error) {
	workDir := a.GetWorkDir()
	return listCursorSessions(workDir)
}

func (a *Agent) DeleteSession(_ context.Context, sessionID string) error {
	homeDir, err := os.UserHomeDir()
	if err != nil {
		return fmt.Errorf("cursor: cannot determine home dir: %w", err)
	}
	workDir := a.GetWorkDir()
	dir, err := findCursorSessionDir(homeDir, workDir, sessionID)
	if err != nil {
		return err
	}
	return os.RemoveAll(dir)
}

func (a *Agent) Stop() error { return nil }

// ── SkillProvider implementation ──────────────────────────────

func (a *Agent) SkillDirs() []string {
	workDir := a.GetWorkDir()
	absDir, err := filepath.Abs(workDir)
	if err != nil {
		absDir = workDir

View on GitHub (pinned to 4000b2338a)

Solutions

  1. Set HOME for the cc-connect process
  2. Confirm the daemon user has a valid home directory
  3. Retry /delete after fixing the environment
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at agent/cursor/cursor.go:223 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/fa0f3342fa90c7ca. Report an issue: GitHub.