{"record":{"id":"dd6c27cb5b216b9b","repo":"affaan-m/ECC","slug":"title-is-required","errorCode":null,"errorMessage":"--title is required.","messagePattern":"--title is required\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/memory.js","lineNumber":414,"sourceCode":"function assertMutationAllowed(command) {\n  if (process.env.ECC_DRY_RUN === '1') {\n    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,","sourceCodeStart":396,"sourceCodeEnd":432,"githubUrl":"https://github.com/affaan-m/ECC/blob/8321021c54d670126ce3b2969d5deb880b4b0c2a/scripts/memory.js#L396-L432","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Add a --title flag with a non-empty value to the command invocation.","Check shell variable expansion: `--title \"${TITLE:?title required}\"` fails fast if TITLE is unset/empty.","Derive a title programmatically in scripts (e.g. first line of the body or a timestamp) when none is supplied.","Update wrapper scripts/wrappers' flag lists to always include --title."],"exampleFix":"// before\nnode scripts/memory.js save --stdin < notes.md\n// after\nnode scripts/memory.js save --stdin --title \"Meeting notes 2026-09-16\" < notes.md","handlingStrategy":"validation","validationCode":"if (!opts.title || opts.title.trim() === '') {\n  throw new Error('--title must be a non-empty string before invoking memory write commands.');\n}","typeGuard":"const hasTitle = (o) => typeof o?.title === 'string' && o.title.trim().length > 0;","tryCatchPattern":"try {\n  runWriteCommand(args);\n} catch (err) {\n  if (err.message === '--title is required.') {\n    console.error('Supply a non-empty --title, e.g. --title \"notes 2026-09-16\".');\n  } else throw err;\n}","preventionTips":["Use `${TITLE:?title required}` expansions so empty shell variables abort early.","Default-generate a title (timestamp or first body line) in wrapper scripts.","Keep --title adjacent to the command word in generated invocations so it is never dropped."],"tags":["cli","missing-argument","validation"],"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"}