affaan-m/ECC · error · Error

--title is required.

Error message

--title is required.

What it means

runWriteCommand validates write-command options before saving. Every write command requires a --title; when options.title is absent or empty it throws '--title is required.' The title becomes part of the stored memory entry, so the CLI refuses to persist untitled content.

Solutions

  1. Add a --title flag with a non-empty value to the command invocation.
  2. Check shell variable expansion: `--title "${TITLE:?title required}"` fails fast if TITLE is unset/empty.
  3. Derive a title programmatically in scripts (e.g. first line of the body or a timestamp) when none is supplied.
  4. Update wrapper scripts/wrappers' flag lists to always include --title.

Example fix

// before
node scripts/memory.js save --stdin < notes.md
// after
node scripts/memory.js save --stdin --title "Meeting notes 2026-09-16" < notes.md
Defensive patterns

Strategy: validation

Validate before calling

if (!opts.title || opts.title.trim() === '') {
  throw new Error('--title must be a non-empty string before invoking memory write commands.');
}

Type guard

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

Try / catch

try {
  runWriteCommand(args);
} catch (err) {
  if (err.message === '--title is required.') {
    console.error('Supply a non-empty --title, e.g. --title "notes 2026-09-16".');
  } else throw err;
}

Prevention

When it happens

Trigger: Running `memory save`, `memory note`, or similar write commands without the --title flag, or with an empty value (`--title ""`). Raised immediately after requireNoPositionals in runWriteCommand.

Common situations: Omitting --title in scripted invocations; shell quoting issues that drop the flag value (`--title "$EMPTY_VAR"`); wrappers that forward only the body and forget metadata.

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/dd6c27cb5b216b9b. Report an issue: GitHub.

Appendix: source

Thrown at scripts/memory.js:414

function assertMutationAllowed(command) {
  if (process.env.ECC_DRY_RUN === '1') {
    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,

View on GitHub (pinned to 8321021c54)