{"record":{"id":"de47936df827d09a","repo":"thedotmack/claude-mem","slug":"bullmq-re-enqueue-failed-will-reconcile-on-startup","errorCode":null,"errorMessage":"BullMQ re-enqueue failed (will reconcile on startup)","messagePattern":"BullMQ re-enqueue failed \\(will reconcile on startup\\)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/npx-cli/commands/server-jobs.ts","lineNumber":287,"sourceCode":"    // Append lifecycle event row matching the audit chain shape.\n    await pool.query(\n      `INSERT INTO observation_generation_job_events (id, generation_job_id, event_type, status_after, attempt, details)\n       VALUES (gen_random_uuid(), $1, 'queued', 'queued', $2, $3::jsonb)`,\n      [id, row.attempts, JSON.stringify({ source: 'cli_operator_retry', retriedCount: newRetriedCount })],\n    );\n\n    await writeOperatorAudit(pool, lookup, 'generation_job.retried_by_operator', {\n      previousStatus: lookup.status,\n      currentStatus: row.status,\n      retriedCount: newRetriedCount,\n    });\n\n    // Best-effort BullMQ re-publish using the deterministic id.\n    if (row.bullmq_job_id) {\n      try {\n        await (testSeams.republishToBullmq ?? republishToBullmq)(row.source_type, row.bullmq_job_id, newPayload);\n      } catch (error) {\n        logger.warn('SYSTEM', 'BullMQ re-enqueue failed (will reconcile on startup)', {\n          jobId: id,\n          error: error instanceof Error ? error.message : String(error),\n        });\n      }\n    }\n\n    console.log(JSON.stringify({\n      id: row.id,\n      action: 'retry',\n      outcome: 'requeued',\n      retriedCount: newRetriedCount,\n      status: row.status,\n      attempts: row.attempts,\n    }, null, 2));\n  } finally {\n    await releasePool();\n  }\n}","sourceCodeStart":269,"sourceCodeEnd":305,"githubUrl":"https://github.com/thedotmack/claude-mem/blob/d8bc9755e74915e5c3b999181e10a67c889bce2a/src/npx-cli/commands/server-jobs.ts#L269-L305","documentation":"In the server jobs CLI, runJobsRetry re-publishes a failed job to BullMQ using its deterministic job id. If the republish call throws, the command logs this warning and continues — reconciliation on startup is expected to eventually re-enqueue the job, so the retry operation itself still succeeds.","triggerScenarios":"Running `claude-mem server jobs retry <id>` when republishToBullmq throws — Redis/BullMQ unavailable, connection refused, queue missing, or the job id conflicts with an existing BullMQ job.","commonSituations":"Redis is down or restarted; network partition between CLI/server and Redis; BullMQ queue was flushed; job row exists in Postgres but was never published to BullMQ.","solutions":["Verify Redis is running and reachable (redis-cli ping) and restart it if needed.","Rely on startup reconciliation — restart the claude-mem server so it reconciles and re-enqueues the job.","Re-run the retry command once connectivity is restored.","Check BullMQ queue configuration/naming if the queue was deliberately changed."],"exampleFix":"// before: Redis down\nredis-cli ping\n// PONG missing -> start redis\nredis-server --daemonize yes\n// after: re-run\nclaude-mem server jobs retry <jobId>","handlingStrategy":"retry","validationCode":"// Probe Redis before retrying jobs\nimport { execSync } from 'node:child_process';\nexecSync('redis-cli ping', { stdio: 'pipe' }); // non-zero exit if Redis is down","typeGuard":"function isRedisConnectionError(e: unknown): boolean {\n  const msg = e instanceof Error ? e.message : String(e);\n  return /ECONNREFUSED|Redis/i.test(msg);\n}","tryCatchPattern":"try {\n  await republishToBullmq(row.source_type, row.bullmq_job_id, newPayload);\n} catch (error) {\n  logger.warn('SYSTEM', 'BullMQ re-enqueue failed (will reconcile on startup)', {\n    jobId: id,\n    error: error instanceof Error ? error.message : String(error),\n  });\n  // startup reconciliation will re-enqueue; optionally retry with backoff\n}","preventionTips":["Monitor Redis health (redis-cli ping) in the same environment as the jobs CLI","Run server startup reconciliation after Redis restarts","Keep BullMQ queue configuration consistent across versions","Alert on Redis connection failures before job retries fail"],"tags":["bullmq","redis","jobs","retry","reconcile"],"backgroundTag":"connection-refused","analyzedSha":"d8bc9755e74915e5c3b999181e10a67c889bce2a","analyzedAt":"2026-09-17T16:40:26.182Z","contentChangedAt":"2026-09-17T16:40:26.182Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}