Skip to content

bug: Silent error discards in credential persistence and config loading #24

Description

@jflowers

Summary

Several locations silently discard errors from credential persistence and configuration loading, making it difficult to diagnose authentication and config failures.

Affected Locations

1. Token persistence errors silently dropped

File: internal/auth/oauth.go:146-148

newJSON, _ := json.Marshal(newToken)  // marshal error dropped
_ = p.store.Set(secrets.KeyOAuthToken, string(newJSON))  // persist error dropped

If token persistence fails, the user will be forced to re-authenticate on every run with no diagnostic information.

2. Credential store write error dropped

File: cmd/gcal-organizer/auth_config.go:104

_ = store.Set(secrets.KeyClientCredentials, string(credsData))

If keychain write fails during auth login, user gets no indication credentials were not saved.

3. UserHomeDir errors dropped

File: cmd/gcal-organizer/main.go:99,129

home, _ := os.UserHomeDir()

If UserHomeDir fails, home is empty and migration runs against a relative path.

Fix

Add warning-level logging at each site:

if err := store.Set(...); err != nil {
    logging.Logger.Warn("failed to persist token to store", "error", err)
}

Priority

MEDIUM — Silent failures make credential issues very difficult to diagnose.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions