chenhg5/cc-connect · error
claudecode: read project dir: %w
Error message
claudecode: read project dir: %w
What it means
Wraps a failed os.ReadDir of the discovered ~/.claude/projects/<project> directory during session listing. Not-exist is treated as 'no sessions'; this error fires only on other IO failures such as permission problems on the project storage directory.
Source
Thrown at agent/claudecode/claudecode.go:583
a.mu.RLock()
workDir := a.workDir
a.mu.RUnlock()
absWorkDir, err := filepath.Abs(workDir)
if err != nil {
return nil, fmt.Errorf("claudecode: resolve work_dir: %w", err)
}
projectDir := findProjectDir(homeDir, absWorkDir)
if projectDir == "" {
return nil, nil
}
entries, err := os.ReadDir(projectDir)
if err != nil {
if os.IsNotExist(err) {
return nil, nil
}
return nil, fmt.Errorf("claudecode: read project dir: %w", err)
}
var sessions []core.AgentSessionInfo
for _, entry := range entries {
name := entry.Name()
if entry.IsDir() || !strings.HasSuffix(name, ".jsonl") {
continue
}
sessionID := strings.TrimSuffix(name, ".jsonl")
info, err := entry.Info()
if err != nil {
continue
}
summary, msgCount := scanSessionMeta(filepath.Join(projectDir, name))
sessions = append(sessions, core.AgentSessionInfo{View on GitHub (pinned to 4000b2338a)
Solutions
- Fix read permissions on the ~/.claude/projects directory
- Confirm the path is a readable directory and not a broken symlink
- Retry /sessions after repair
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at agent/claudecode/claudecode.go:583 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/db3d729fd6357489.
Report an issue: GitHub.