Summary
In internal/data/store.go line 102, the error returned by os.UserHomeDir() is silently discarded:
go homeDir, _ := os.UserHomeDir() return &Store{db: db, hasHostType: hasHostType, hasFTS5: hasFTS5, tempDir: os.TempDir(), homeDir: homeDir}, nil
If os.UserHomeDir() fails, homeDir is an empty string, which silently breaks any downstream logic that depends on the home directory path (e.g., path resolution, session-state directory lookups).
Why This Matters
- Silent data corruption: An empty homeDir propagates through the Store and any method that builds paths relative to the home directory.
- Hard-to-debug failures: Downstream errors will point to missing files or wrong paths with no indication that the root cause is a failed home directory lookup.
- Platform edge cases: On CI runners, containers, or non-standard environments, HOME may not be set, making this a real failure mode.
Suggested Fix
Handle the error explicitly — either fail fast or log a warning:
go homeDir, err := os.UserHomeDir() if err != nil { return nil, fmt.Errorf("resolving home directory: %w", err) }
If graceful degradation is preferred, at minimum log the failure so it is diagnosable:
go homeDir, err := os.UserHomeDir() if err != nil { slog.Warn("could not determine home directory", "error", err) }
Smell Categories
- Modern → Error Swallowing (ignored error return value on a fallible OS call)
Summary
In internal/data/store.go line 102, the error returned by os.UserHomeDir() is silently discarded:
go homeDir, _ := os.UserHomeDir() return &Store{db: db, hasHostType: hasHostType, hasFTS5: hasFTS5, tempDir: os.TempDir(), homeDir: homeDir}, nilIf os.UserHomeDir() fails, homeDir is an empty string, which silently breaks any downstream logic that depends on the home directory path (e.g., path resolution, session-state directory lookups).
Why This Matters
Suggested Fix
Handle the error explicitly — either fail fast or log a warning:
go homeDir, err := os.UserHomeDir() if err != nil { return nil, fmt.Errorf("resolving home directory: %w", err) }If graceful degradation is preferred, at minimum log the failure so it is diagnosable:
go homeDir, err := os.UserHomeDir() if err != nil { slog.Warn("could not determine home directory", "error", err) }Smell Categories