{"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/8321021c54d670126ce3b2969d5deb880b4b0c2a/scripts/memory.js#L380-L416","documentation":"assertMutationAllowed blocks every mutating memory command when the ECC_DRY_RUN environment variable is set to '1'. Before runInitCommand/runWriteCommand etc. touch the vault, runCommand calls this guard and throws, stating that no files were written. It is an intentional safety gate for preview/rehearsal runs.","triggerScenarios":"Invoking any mutating memory command (init, save, handoff, etc.) with ECC_DRY_RUN=1 in the environment; the guard is called from runCommand before the command handler executes.","commonSituations":"Leaving ECC_DRY_RUN=1 exported from an earlier rehearsal session or CI job; running inside a wrapper/CI environment that sets the variable globally; forgetting to unset it before a real write.","solutions":["Unset or clear the variable for the real run: `ECC_DRY_RUN= node scripts/memory.js <command>` or `unset ECC_DRY_RUN`.","Run the intended command with the variable explicitly overridden: `env -u ECC_DRY_RUN node scripts/memory.js ...`.","If this was meant to be a preview, keep dry-run and inspect the printed plan instead of forcing a write.","In CI, scope ECC_DRY_RUN=1 to the rehearsal step only (env per-step), not the whole job."],"exampleFix":"// before (fails in dry-run)\nECC_DRY_RUN=1 node scripts/memory.js save --stdin --title t\n// after\nunset ECC_DRY_RUN && node scripts/memory.js save --stdin --title t","handlingStrategy":"fallback","validationCode":"if (process.env.ECC_DRY_RUN === '1' && wantsRealWrite) {\n  throw new Error('ECC_DRY_RUN=1 is set; unset it before running a real write.');\n}","typeGuard":null,"tryCatchPattern":"try {\n  runMemoryCommand(cmd);\n} catch (err) {\n  if (String(err.message).includes('disabled in dry-run mode')) {\n    console.error('Dry-run is active (ECC_DRY_RUN=1). Re-run with ECC_DRY_RUN unset to write.');\n  } else throw err;\n}","preventionTips":["Scope ECC_DRY_RUN=1 to individual rehearsal commands, never export it in shell profiles.","Echo ECC_DRY_RUN at the start of write scripts so the mode is visible in logs.","Treat the dry-run message as informational: it confirms no files were written, by design."],"tags":["cli","dry-run","environment-variable","mutation-guard"],"backgroundTag":"feature-not-enabled","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"}