{"record":{"id":"2f8c794ebfc4d152","repo":"affaan-m/ECC","slug":"from-is-required-for-handoffs","errorCode":null,"errorMessage":"--from is required for handoffs.","messagePattern":"--from is required for handoffs\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/memory.js","lineNumber":416,"sourceCode":"    throw new Error(\n      `memory ${command} is disabled in dry-run mode; no files were written.`\n    );\n  }\n}\n\nfunction runInitCommand({ command, options, positionals, roots }) {\n  requireNoPositionals(positionals, command);\n  return printInit(\n    initializeVault({ roots, scopes: options.scopes || undefined }),\n    options.json\n  );\n}\n\nfunction runWriteCommand({ command, options, positionals, roots }) {\n  requireNoPositionals(positionals, command);\n  if (!options.title) throw new Error('--title is required.');\n  if (command === 'handoff' && !options.from) {\n    throw new Error('--from is required for handoffs.');\n  }\n  if (command === 'handoff' && (!options.targets || options.targets.length === 0)) {\n    throw new Error('At least one --target is required for handoffs.');\n  }\n  return printWrite(\n    saveMemory(saveInput(options, command === 'handoff' ? 'handoff' : null), { roots }),\n    options.json\n  );\n}\n\nfunction runSearchCommand({ options, positionals, roots }) {\n  const query = positionals.join(' ');\n  return printSearch(query, searchMemories(query, {\n    roots,\n    scopes: options.scopes,\n    kinds: options.kinds,\n    targetHarness: options.targetHarness,\n    limit: options.limit,","sourceCodeStart":398,"sourceCodeEnd":434,"githubUrl":"https://github.com/affaan-m/ECC/blob/8321021c54d670126ce3b2969d5deb880b4b0c2a/scripts/memory.js#L398-L434","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Add `--from <agent-or-author>` to the handoff invocation with a non-empty identifier.","In automation, source it from a known identity variable with a guard: `--from \"${AGENT:?agent identity required}\"`.","If this is not actually a handoff, use the plain save/note command which does not require --from.","Update CI/task templates for handoffs to always emit --from alongside --target."],"exampleFix":"// before\nnode scripts/memory.js handoff --title \"ctx\" --target codex --body-file ctx.md\n// after\nnode scripts/memory.js handoff --title \"ctx\" --from claude --target codex --body-file ctx.md","handlingStrategy":"validation","validationCode":"if (command === 'handoff' && (!opts.from || opts.from.trim() === '')) {\n  throw new Error('handoff requires --from <agent-identity>.');\n}","typeGuard":"const hasFrom = (o) => typeof o?.from === 'string' && o.from.trim().length > 0;","tryCatchPattern":"try {\n  runWriteCommand(args);\n} catch (err) {\n  if (err.message === '--from is required for handoffs.') {\n    console.error('Add --from <agent> to identify the handoff sender.');\n  } else throw err;\n}","preventionTips":["Source --from from a well-known identity env var with a `:?` guard.","Include --from in every handoff template/CI step by default.","Only use the handoff command when an origin identity is actually known."],"tags":["cli","missing-argument","handoff"],"backgroundTag":"missing-required-flag","analyzedSha":"8321021c54d670126ce3b2969d5deb880b4b0c2a","analyzedAt":"2026-09-16T10:08:13.343Z","contentChangedAt":"2026-09-16T10:08:13.343Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}