Skip to content

Cache save fails after creating new YNAB account #52

@tlmaloney

Description

@tlmaloney

When I was testing #51, I ran into what looks like an existing, orthogonal issue:

2025-11-23 11:48:38,205 - urllib3.connectionpool - DEBUG - Starting new HTTPS connection (1): api.ynab.com:443
2025-11-23 11:48:38,329 - urllib3.connectionpool - DEBUG - https://api.ynab.com:443 "GET /v1/budgets HTTP/1.1" 200 None
2025-11-23 11:48:38,368 - urllib3.connectionpool - DEBUG - https://api.ynab.com:443 "GET /v1/budgets/my-budget-id/accounts HTTP/1.1" 200 None
2025-11-23 11:48:38,368 - moneyflow.ynab_client - INFO - Cached 0 accounts (0 tracking, 0 budget)
2025-11-23 11:48:38,408 - urllib3.connectionpool - DEBUG - https://api.ynab.com:443 "GET /v1/budgets HTTP/1.1" 200 None
2025-11-23 11:48:49,825 - moneyflow.app - DEBUG - Starting login flow for ynab
2025-11-23 11:48:49,825 - moneyflow.app - DEBUG - Email:
2025-11-23 11:48:49,825 - moneyflow.app - DEBUG - Has MFA secret: False
2025-11-23 11:48:49,826 - moneyflow.retry_logic - INFO - Attempting Login to backend (attempt 1/5)
2025-11-23 11:48:49,826 - moneyflow.app - DEBUG - Attempting login with saved session...
2025-11-23 11:48:49,826 - urllib3.connectionpool - DEBUG - Starting new HTTPS connection (1): api.ynab.com:443
2025-11-23 11:48:49,933 - urllib3.connectionpool - DEBUG - https://api.ynab.com:443 "GET /v1/budgets HTTP/1.1" 200 None
2025-11-23 11:48:49,989 - urllib3.connectionpool - DEBUG - https://api.ynab.com:443 "GET /v1/budgets/my-budget-id/accounts HTTP/1.1" 200 None
2025-11-23 11:48:49,990 - moneyflow.ynab_client - INFO - Cached X accounts (Y tracking, Z budget)
2025-11-23 11:48:49,990 - moneyflow.app - DEBUG - Login succeeded!
2025-11-23 11:48:49,990 - moneyflow.app - DEBUG - Login flow completed successfully
2025-11-23 11:48:49,991 - moneyflow.categories - INFO - Using built-in default categories
2025-11-23 11:48:49,991 - moneyflow.categories - INFO - Using built-in default categories
2025-11-23 11:48:49,991 - moneyflow.retry_logic - INFO - Attempting Fetch transaction data (attempt 1/5)
2025-11-23 11:48:49,991 - moneyflow.app - DEBUG - Fetching transactions (start=None, end=None)
2025-11-23 11:48:50,205 - urllib3.connectionpool - DEBUG - https://api.ynab.com:443 "GET /v1/budgets/my-budget-id/categories HTTP/1.1" 200 None
2025-11-23 11:48:50,402 - urllib3.connectionpool - DEBUG - https://api.ynab.com:443 "GET /v1/budgets/my-budget-id/categories HTTP/1.1" 200 None
2025-11-23 11:48:50,419 - moneyflow.categories - INFO - Saved X category groups (Y categories) to /home/tmaloney/.moneyflow/profiles/ynab-default/config.yaml
2025-11-23 11:48:50,421 - moneyflow.categories - INFO - Loaded categories from /home/tmaloney/.moneyflow/profiles/ynab-default/config.yaml: X groups, Y categories
2025-11-23 11:48:50,421 - moneyflow.data_manager - DEBUG - Rebuilt category-to-group mapping with fresh categories
2025-11-23 11:49:03,816 - urllib3.connectionpool - DEBUG - https://api.ynab.com:443 "GET /v1/budgets/my-budget-id/transactions HTTP/1.1" 200 None
2025-11-23 11:49:05,354 - moneyflow.data_manager - INFO - Fetching all merchants from API...
2025-11-23 11:49:05,513 - urllib3.connectionpool - DEBUG - https://api.ynab.com:443 "GET /v1/budgets/my-budget-id/payees HTTP/1.1" 200 None
2025-11-23 11:49:05,546 - moneyflow.data_manager - INFO - Saved N merchants to cache
2025-11-23 11:49:05,547 - moneyflow.data_manager - INFO - Loaded N cached merchants
2025-11-23 11:49:05,547 - moneyflow.app - DEBUG - Data fetch succeeded - loaded a lot transactions
2025-11-23 11:49:05,547 - moneyflow.app - ERROR - Data fetch failed after all retries: Cannot save cache: encryption key not set
Traceback (most recent call last):
  File "/home/tmaloney/gitdev/com.github/tlmaloney/moneyflow/moneyflow/app.py", line 894, in _fetch_data_with_retry
    self.cache_manager.save_cache(
  File "/home/tmaloney/gitdev/com.github/tlmaloney/moneyflow/moneyflow/cache_manager.py", line 180, in save_cache
    raise ValueError("Cannot save cache: encryption key not set")
ValueError: Cannot save cache: encryption key not set

I think claude has a fix, but need some time to review it.

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