Skip to content

Add error handling/logging for silent failures #7

@Fuabioo

Description

@Fuabioo

Problem

Several places in the codebase silently ignore errors, which can lead to confusing behavior for users when operations fail without any indication.

Evidence

1. internal/cli/list.go:79

projects, _ := history.ListProjects(cfg.ProjectsDir)
projectCount = len(projects)

If ListProjects fails, projectCount becomes 0 with no indication of failure.

2. internal/cli/stats.go:62-72

conversations, err := scanner.ScanAll()
if err == nil {
    for _, c := range conversations {
        // ...
    }
}

Stats command shows partial or empty data if scanning fails, with no warning to the user.

3. internal/history/scanner.go:103-106

projectFiles, err := s.scanDir(projectDir)
if err != nil {
    continue // Skip directories we can't read
}

Permission errors or corrupted directories are silently skipped.

Impact

Users may see incorrect or incomplete data without knowing something went wrong. This makes debugging issues difficult.

Suggested Fix

Consider either:

  1. Return errors up the call stack so they can be handled appropriately
  2. Add warning logs when errors are encountered but recoverable
  3. Include a summary of any skipped items in the output (e.g., "Scanned 10 projects, 2 skipped due to permission errors")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions