Worker crashes on startup due to unhandled Promise rejection in ensureBackfilled() (v8.0.2 regression)
Bug Description
The worker service crashes during startup in v8.0.2 due to an unhandled Promise rejection in ChromaSync.ensureBackfilled(). This is a regression from v7.4.5 where the error was properly caught and logged as non-fatal.
Root Cause: The .catch() error handler was removed from DatabaseManager.ts in v8.0.2, causing any errors during Chroma backfill to crash the worker process instead of being logged as warnings.
Steps to Reproduce
- Install claude-mem v8.0.2 via
claude plugin add claude-mem
- Start the worker service (happens automatically or via
npm run worker:start)
- Worker crashes during Chroma backfill process when encountering any error
Common triggers:
- Chroma MCP server returns malformed JSON responses
- Network issues during Chroma communication
- Chroma collection initialization errors
- Python/uvx environment issues
Expected Behavior
Worker should start successfully and log any Chroma sync errors as non-fatal warnings (as in v7.4.5). The worker can operate without Chroma, falling back to SQLite FTS search.
Environment
- Claude-mem version: 8.0.2
- Claude Code version: (not applicable - installed via plugin)
- OS: macOS (Darwin 25.1.0)
- Platform: darwin
- Node.js: v24.11.1
- Bun: 1.3.5
- Python: 3.11.9 (system), 3.13 (configured in settings)
- uv: 0.9.15
Logs
Worker logs are located at:
- Path:
~/.claude-mem/logs/worker-YYYY-MM-DD.log
- Example:
~/.claude-mem/logs/worker-2025-12-23.log
Please paste relevant log entries (last 50 lines or error messages):
[2025-12-23 13:41:00.180] [INFO ] [CHROMA_SYNC] Connected to Chroma MCP server {project=claude-mem}
[2025-12-23 13:41:00.182] [INFO ] [CHROMA_SYNC] Fetching existing Chroma document IDs... {project=claude-mem}
[2025-12-23 13:41:00.183] [ERROR] [CHROMA_SYNC] Failed to fetch existing IDs {project=claude-mem} JSON Parse error: Unexpected identifier "Error"
717 | created_at,
718 | created_at_epoch
719 | FROM user_prompts
720 | WHERE claude_session_id = ?
721 | ORDER BY prompt_number ASC
722 | `).all(e)}close(){this.db.close()}};Iu();mt();Dr();dr();var r1=kt(require("path"),1),a1=kt(require("os"),1),Nu=class{client=null;transport=null;connected=!1;project;collectionName;VECTOR_DB_DIR;BATCH_SIZE=100;constructor(e){this.project=e,this.collectionName=`cm__${e}`,this.VECTOR_DB_DIR=r1.default.join(a1.default.homedir(),".claude-mem","vector-db")}async ensureConnection(){if(!(this.connected&&this.client)){U.info("CHROMA_SYNC","Connecting to Chroma MCP server...",{project:this.project});try{let r=ct.loadFromFile(In).CLAUDE_MEM_PYTHON_VERSION,n=process.platform==="win32",a={command:"uvx",args:["--python",r,"chroma-mcp","--client-type","persistent","--data-dir",this.VECTOR_DB_DIR],stderr:"ignore"};n&&(a.windowsHide=!0,U.debug("CHROMA_SYNC","Windows detected, attempting to hide console window",{project:this.project})),this.transport=new Ms(a),this.client=new As({name:"claude-mem-chroma-sync",version:"1.0.0"},{capabilities:{}}),await this.client.connect(this.transport),this.connected=!0,U.info("CHROMA_SYNC
SyntaxError: JSON Parse error: Unexpected identifier "Error"
at getExistingChromaIds (/Users/akihiro.hayaishi/.claude/plugins/marketplaces/thedotmack/plugin/scripts/worker-service.cjs:722:6756)
at async ensureBackfilled (/Users/akihiro.hayaishi/.claude/plugins/marketplaces/thedotmack/plugin/scripts/worker-service.cjs:722:7495)
Bun v1.3.5 (macOS arm64)
Additional Context
Code Regression Analysis
Location: src/services/worker/DatabaseManager.ts (lines 30-33)
v7.4.5 (working):
// Start background backfill (fire-and-forget, with error logging)
this.chromaSync.ensureBackfilled().catch((error) => {
logger.error('DB', 'Chroma backfill failed (non-fatal)', {}, error);
});
v8.0.2 (broken):
// Start background backfill (fire-and-forget)
this.chromaSync.ensureBackfilled();
Impact
When ensureBackfilled() encounters any error, the Promise rejection goes unhandled, causing the worker process to crash. This prevents the worker from starting successfully and makes the plugin completely unusable.
Proposed Fix
Restore the .catch() error handler in DatabaseManager.ts:
async initialize(): Promise<void> {
this.sessionStore = new SessionStore();
this.sessionSearch = new SessionSearch();
// Initialize ChromaSync
this.chromaSync = new ChromaSync('claude-mem');
// Start background backfill (fire-and-forget, with error logging)
this.chromaSync.ensureBackfilled().catch((error) => {
logger.error('DB', 'Chroma backfill failed (non-fatal)', {}, error);
});
logger.info('DB', 'Database initialized');
}
This ensures that Chroma sync errors are logged but don't prevent the worker from starting, maintaining backward compatibility with v7.4.5 behavior.
Workaround
Currently, the only workaround is to:
- Downgrade to v7.4.5, or
- Build from the v7.4.5 tag manually
Reference
- Git diff:
v7.4.5...v8.0.2
- The error handler removal appears to have been unintentional
- In v7.4.5, the comment explicitly states "with error logging" and treats Chroma backfill failures as non-fatal, which is correct since the worker can operate without Chroma
Worker crashes on startup due to unhandled Promise rejection in ensureBackfilled() (v8.0.2 regression)
Bug Description
The worker service crashes during startup in v8.0.2 due to an unhandled Promise rejection in
ChromaSync.ensureBackfilled(). This is a regression from v7.4.5 where the error was properly caught and logged as non-fatal.Root Cause: The
.catch()error handler was removed fromDatabaseManager.tsin v8.0.2, causing any errors during Chroma backfill to crash the worker process instead of being logged as warnings.Steps to Reproduce
claude plugin add claude-memnpm run worker:start)Common triggers:
Expected Behavior
Worker should start successfully and log any Chroma sync errors as non-fatal warnings (as in v7.4.5). The worker can operate without Chroma, falling back to SQLite FTS search.
Environment
Logs
Worker logs are located at:
~/.claude-mem/logs/worker-YYYY-MM-DD.log~/.claude-mem/logs/worker-2025-12-23.logPlease paste relevant log entries (last 50 lines or error messages):
Additional Context
Code Regression Analysis
Location:
src/services/worker/DatabaseManager.ts(lines 30-33)v7.4.5 (working):
v8.0.2 (broken):
Impact
When
ensureBackfilled()encounters any error, the Promise rejection goes unhandled, causing the worker process to crash. This prevents the worker from starting successfully and makes the plugin completely unusable.Proposed Fix
Restore the
.catch()error handler inDatabaseManager.ts:This ensures that Chroma sync errors are logged but don't prevent the worker from starting, maintaining backward compatibility with v7.4.5 behavior.
Workaround
Currently, the only workaround is to:
Reference
v7.4.5...v8.0.2