{"record":{"id":"8deafbec51180f85","repo":"affaan-m/ECC","slug":"memory-command-is-disabled-in-dry-run-mode-no","errorCode":null,"errorMessage":"memory ${command} is disabled in dry-run mode; no files were written.","messagePattern":"memory (.+?) is disabled in dry-run mode; no files were written\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"scripts/memory.js","lineNumber":398,"sourceCode":"  const sourceHarness = options.from\n    || options.sourceHarness\n    || process.env.ECC_MEMORY_HARNESS\n    || 'unknown';\n  return {\n    title: options.title,\n    body: readBody(options),\n    kind: kindOverride || oneValue(options.kinds, '--kind', 'note'),\n    scope: oneValue(options.scopes, '--scope', 'project'),\n    sourceHarness,\n    targetHarnesses: options.targets || ['all'],\n    tags: options.tags || [],\n    links: options.links || [],\n  };\n}\n\nfunction 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.');","sourceCodeStart":380,"sourceCodeEnd":416,"githubUrl":"https://github.com/affaan-m/ECC/blob/01e15490f04e29cfefe3896951f43db46994d8ee/scripts/memory.js#L380-L416","documentation":"assertMutationAllowed throws `memory <command> is disabled in dry-run mode; no files were written.` whenever the ECC_DRY_RUN environment variable is exactly '1' and a mutating memory command (init/save/handoff/doctor-write path) runs. It is an intentional safety brake so dry-run tooling that imports the CLI cannot accidentally persist memories. The check is intentionally strict: only the literal string '1' triggers it.","triggerScenarios":"Running `ECC_DRY_RUN=1 ecc memory save ...`. A parent process/harness that exports ECC_DRY_RUN=1 globally (e.g. a rehearsal or audit mode) and then invokes a memory write. CI that dry-runs the whole ECC CLI to validate args.","commonSituations":"Forgetting that a dry-run env was set in the current shell. An audit/rehearsal wrapper that sets ECC_DRY_RUN=1 and you intended a real write. Misconfigured dotfiles exporting the flag.","solutions":["Unset or override the flag for the real write: `ECC_DRY_RUN=0 ecc memory save ...` or `env -u ECC_DRY_RUN ecc memory save ...`.","Inspect the environment: `echo \"$ECC_DRY_RUN\"` — if it prints 1, that is the cause.","Confirm only the literal '1' disables writes; 'true'/'yes'/0 do not, so set it accordingly.","Keep dry-run shells separate from write shells to avoid accidental state bleed."],"exampleFix":"# before — global dry-run blocks the write\nexport ECC_DRY_RUN=1\necc memory save --title \"notes\" --body-file notes.md   # throws\n\n# after — opt this invocation out of dry-run\nECC_DRY_RUN=0 ecc memory save --title \"notes\" --body-file notes.md\n# or unset for the shell\nunset ECC_DRY_RUN","handlingStrategy":"validation","validationCode":"// Detect the dry-run gate before attempting a mutating command.\nfunction assertMutationAllowed(command) {\n  if (process.env.ECC_DRY_RUN === '1') {\n    throw new Error(`memory ${command} is disabled in dry-run mode; no files were written.`);\n  }\n}\n// Or, to permit writes, ensure the flag is not '1':\nif (process.env.ECC_DRY_RUN === '1' && !process.env.ECC_DRY_RUN_OVERRIDE) {\n  console.error('Unset ECC_DRY_RUN or set ECC_DRY_RUN=0 to write.');\n  process.exit(2);\n}","typeGuard":null,"tryCatchPattern":"try { runCommand(parsed); }\ncatch (err) {\n  if (/disabled in dry-run mode/.test(err.message)) {\n    console.error(`${err.message} Re-run with ECC_DRY_RUN=0 to persist.`);\n    process.exit(2);\n  } else throw err;\n}","preventionTips":["Keep dry-run shells separate from write shells; do not export ECC_DRY_RUN globally.","Use `env -u ECC_DRY_RUN ecc memory ...` to explicitly opt out for one invocation.","Remember only the literal '1' disables writes; other truthy strings do not."],"tags":["memory-vault","environment","dry-run","safety-guard"],"backgroundTag":null,"analyzedSha":"01e15490f04e29cfefe3896951f43db46994d8ee","analyzedAt":"2026-08-13T00:31:08.655Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}