affaan-m/ECC · error · Error

No memory root is configured for scope

Error message

No memory root is configured for scope "${scope}".

What it means

assertMemoryRootSafe throws when the roots object has no non-empty string root for the requested scope (project, team, or user). It fires when the corresponding env vars (ECC_MEMORY_PROJECT_ROOT etc.) and defaults yield nothing — the faulting input is the missing scope entry.

Solutions

  1. Set the scope's root via ECC_MEMORY_PROJECT_ROOT / ECC_MEMORY_USER_ROOT or ensure homeDir/projectRoot defaults resolve.
  2. Check which scope string was passed — typos yield unknown scopes with no root.
  3. Initialize memory roots before calling read/save operations.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at scripts/lib/memory-vault.js:103 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of affaan-m/ECC@8321021c54 (2026-09-16). Data as JSON: /api/errors/f7e07b377a2dc468. Report an issue: GitHub.

Appendix: source

Thrown at scripts/lib/memory-vault.js:103

        : projectRoot,
      user: env.ECC_MEMORY_USER_ROOT
        ? realpathNearestExisting(userVault)
        : homeDir,
    }),
    enumerable: false,
    configurable: false,
    writable: false,
  });
  return Object.freeze(roots);
}

function assertMemoryRootSafe(roots, scope) {
  if (!roots || typeof roots !== 'object' || Array.isArray(roots)) {
    throw new Error('Memory roots must include a trusted boundary policy.');
  }
  const root = roots[scope];
  if (typeof root !== 'string' || root.length === 0) {
    throw new Error(`No memory root is configured for scope "${scope}".`);
  }
  const boundary = roots[VAULT_ROOT_BOUNDARIES]?.[scope];
  if (typeof boundary !== 'string' || boundary.length === 0) {
    throw new Error(`No trusted boundary policy is configured for memory scope "${scope}".`);
  }
  assertWithinTrustedRoot(root, boundary, 'access memory through a symlink');
  if (fs.existsSync(root) && fs.lstatSync(root).isSymbolicLink()) {
    throw new Error(`Refusing to access memory through symlink root: ${root}`);
  }
  return root;
}

function assertMemoryDirectorySafe(directory, root) {
  assertWithinTrustedRoot(directory, root, 'access memory directory');
  if (fs.existsSync(directory) && fs.lstatSync(directory).isSymbolicLink()) {
    throw new Error(`Refusing to access memory through symlink directory: ${directory}`);
  }
  return directory;

View on GitHub (pinned to 8321021c54)