affaan-m/ECC · error · Error

--from is required for handoffs.

Error message

--from is required for handoffs.

What it means

Handoff write commands need a --from value identifying the sender/origin agent. runWriteCommand checks `command === 'handoff' && !options.from` and throws '--from is required for handoffs.' This metadata is stored with the handoff so the receiving agent knows who produced it.

Solutions

  1. Add `--from <agent-or-author>` to the handoff invocation with a non-empty identifier.
  2. In automation, source it from a known identity variable with a guard: `--from "${AGENT:?agent identity required}"`.
  3. If this is not actually a handoff, use the plain save/note command which does not require --from.
  4. Update CI/task templates for handoffs to always emit --from alongside --target.

Example fix

// before
node scripts/memory.js handoff --title "ctx" --target codex --body-file ctx.md
// after
node scripts/memory.js handoff --title "ctx" --from claude --target codex --body-file ctx.md
Defensive patterns

Strategy: validation

Validate before calling

if (command === 'handoff' && (!opts.from || opts.from.trim() === '')) {
  throw new Error('handoff requires --from <agent-identity>.');
}

Type guard

const hasFrom = (o) => typeof o?.from === 'string' && o.from.trim().length > 0;

Try / catch

try {
  runWriteCommand(args);
} catch (err) {
  if (err.message === '--from is required for handoffs.') {
    console.error('Add --from <agent> to identify the handoff sender.');
  } else throw err;
}

Prevention

When it happens

Trigger: Running `memory handoff` (or equivalent) with --title and --target(s) but no --from flag, or with an empty --from value. Raised in runWriteCommand after the --title check.

Common situations: Copy-pasting a save command pattern and adapting it to handoff while dropping the --from flag; automated tooling that builds handoff invocations without knowing the current agent identity; empty AGENT env var interpolated into --from.

Understand the failure class

Background: "--flag is required" and "must specify" CLI errors: how missing-required-flag validation works and how to fix it — this error's family across 20 libraries.

Related errors


AI-assisted analysis of affaan-m/ECC@8321021c54 (2026-09-16). Data as JSON: /api/errors/2f8c794ebfc4d152. Report an issue: GitHub.

Appendix: source

Thrown at scripts/memory.js:416

    throw new Error(
      `memory ${command} is disabled in dry-run mode; no files were written.`
    );
  }
}

function runInitCommand({ command, options, positionals, roots }) {
  requireNoPositionals(positionals, command);
  return printInit(
    initializeVault({ roots, scopes: options.scopes || undefined }),
    options.json
  );
}

function runWriteCommand({ command, options, positionals, roots }) {
  requireNoPositionals(positionals, command);
  if (!options.title) throw new Error('--title is required.');
  if (command === 'handoff' && !options.from) {
    throw new Error('--from is required for handoffs.');
  }
  if (command === 'handoff' && (!options.targets || options.targets.length === 0)) {
    throw new Error('At least one --target is required for handoffs.');
  }
  return printWrite(
    saveMemory(saveInput(options, command === 'handoff' ? 'handoff' : null), { roots }),
    options.json
  );
}

function runSearchCommand({ options, positionals, roots }) {
  const query = positionals.join(' ');
  return printSearch(query, searchMemories(query, {
    roots,
    scopes: options.scopes,
    kinds: options.kinds,
    targetHarness: options.targetHarness,
    limit: options.limit,

View on GitHub (pinned to 8321021c54)