ruvnet/ruflo · error · Error

memory store failed: ${r.stderr?.slice(0, 200) || r.status}

Error message

memory store failed: ${r.stderr?.slice(0, 200) || r.status}

What it means

memoryStore() ran the claude-flow CLI `memory store` subprocess and it exited non-zero (stderr prefix captured, or just the exit status). The budget-config write to the cost-tracking namespace failed — commonly the UNIQUE-key constraint quirk the timestamp-suffix workaround targets, or the CLI being unavailable.

Source

Thrown at plugins/ruflo-cost-tracker/scripts/budget.mjs:44

  ? '@claude-flow/cli-core@alpha'
  : '@claude-flow/cli@latest';

const NS = process.env.BUDGET_NAMESPACE || 'cost-tracking';
const KEY = 'budget-config';

function memoryStore(key, value) {
  // The @claude-flow/cli memory layer has a UNIQUE-constraint quirk where
  // `store` rejects keys that `retrieve` doesn't surface. Workaround:
  // - For the budget-config key (single record), append a timestamp suffix
  //   on each write and update a small index that points at the latest.
  //   This avoids the conflict entirely. Retrieve resolves via the index.
  if (key === KEY) {
    const stamped = `${KEY}-${Date.now()}`;
    const r = spawnNpxSync([
      CLI_PKG, 'memory', 'store',
      '--namespace', NS, '--key', stamped, '--value', JSON.stringify(value),
    ], { stdio: ['ignore', 'pipe', 'pipe'], encoding: 'utf-8', shell: process.platform === 'win32' });
    if (r.status !== 0) throw new Error(`memory store failed: ${r.stderr?.slice(0, 200) || r.status}`);
    // The "current pointer" is found at retrieval time by listing all
    // budget-config-* keys and picking the lexicographically-largest
    // (timestamp suffixes sort correctly because they are equal-width).
    return;
  }
  const r = spawnNpxSync([
    CLI_PKG, 'memory', 'store',
    '--namespace', NS, '--key', key, '--value', JSON.stringify(value),
  ], { stdio: ['ignore', 'pipe', 'pipe'], encoding: 'utf-8', shell: process.platform === 'win32' });
  if (r.status !== 0) throw new Error(`memory store failed: ${r.stderr?.slice(0, 200) || r.status}`);
}

function memoryRetrieveOne(key) {
  const r = spawnNpxSync([
    CLI_PKG, 'memory', 'retrieve',
    '--namespace', NS, '--key', key, '--value-only',
  ], { stdio: ['ignore', 'pipe', 'pipe'], encoding: 'utf-8', shell: process.platform === 'win32' });
  if (r.status !== 0) return null;

View on GitHub (pinned to fa13ee4ad6)

Solutions

  1. Inspect the underlying cause in logs, fix the root issue, and retry the operation.
  2. Validate inputs and preconditions before invoking this code path so the error is avoided.
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at plugins/ruflo-cost-tracker/scripts/budget.mjs:44 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of ruvnet/ruflo@fa13ee4ad6 (2026-08-18). Data as JSON: /api/errors/e12088ad8e40c9e6. Report an issue: GitHub.