Skip to content

[BUG] Memory sync silently fails with misleading ✓ success indicator when LLM auth is invalid #31

@FZ2000

Description

@FZ2000

Tool(s) Affected

All: claude-code, cursor, gemini-cli, github-copilot, openclaw, windsurf

What Happened

Running apc memory sync --all --yes (or apc sync --all --yes) when the configured LLM API key is invalid produces:

! LLM call failed (Anthropic API returned 401: {"type":"error","error":{"type":"authentication_error","message":"invalid x-api-key"}}), skipping memory sync for claude-code
✓ claude-code: 0 memory files
! LLM call failed (...), skipping memory sync for cursor
✓ cursor: 0 memory files
... (repeated for all 6 tools)

What Was Expected

  • The overall sync should fail loudly with a non-zero exit code
  • The success indicator should NOT appear after a failure
  • The final summary should NOT say "Synced: 0 memory files" as if that's acceptable
  • The user should be told how to fix it: apc configure --provider anthropic --api-key ...

Root Cause

In src/appliers/base.py, apply_memory_via_llm() catches the exception and returns 0 (silent skip), then sync_helpers.py counts "0 memory files" and prints a . The warning is printed but then overridden by the success indicator.

Impact

A user who runs apc sync with an expired or misconfigured API key gets zero feedback that their 203-entry memory cache was never synced. All 6 tools show . The cache has 203 memory entries; 0 were written to any tool. This is data loss without warning.

Suggested Fix

  1. Return a failure status from apply_memory_via_llm() when an auth/network error occurs
  2. Use (not ) in the per-tool output when memory sync was skipped due to error
  3. Exit with code 1 if any component of sync fails
  4. Print a clear actionable fix hint: Run: apc configure --provider anthropic --api-key YOUR_KEY

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