affaan-m/ECC · error

projectRoot or repoRoot is required for project install…

Error message

projectRoot or repoRoot is required for project install targets

What it means

resolveBaseRoot in install-target helpers computes the root directory for project-scope install targets (where configs like project-level MCP or agent files are written). For scope 'project' it requires either projectRoot or repoRoot in the input; without either it cannot know where to place files and throws.

Solutions

  1. Pass `projectRoot` (or `repoRoot`) in the options/input to the install target call
  2. If calling the installer CLI, run it from inside the target repository so repoRoot is resolved
  3. Check your custom adapter/script to ensure it forwards repoRoot into the target planning input

Example fix

// before
const root = baseRoot('project', {});
// after
const root = baseRoot('project', { repoRoot: process.cwd() });
Defensive patterns

Strategy: validation

Validate before calling

// Ensure roots are provided before invoking project-scope targets
function assertProjectRoot(input = {}) {
  if (!input.projectRoot && !input.repoRoot) {
    throw new Error('project install targets need projectRoot or repoRoot');
  }
}

Type guard

function hasProjectRoot(input) {
  return typeof input === 'object' && input !== null
    && (typeof input.projectRoot === 'string' || typeof input.repoRoot === 'string');
}

Try / catch

try {
  baseRoot('project', input);
} catch (e) {
  if (/projectRoot or repoRoot is required/.test(e.message)) {
    input.repoRoot = process.cwd(); // or the resolved workspace root
  } else throw e;
}

Prevention

When it happens

Trigger: baseRoot('project', input) is called with an input object lacking both projectRoot and repoRoot — e.g. an adapter or caller resolved the planning input without passing the repository root through.

Common situations: Invoking an install target adapter directly from a custom script without providing repoRoot; a code path that builds target input omitted projectRoot after a refactor; running the installer from a context where repoRoot detection failed.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — 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/3b2ceddbdf23c320. Report an issue: GitHub.

Appendix: source

Thrown at scripts/lib/install-targets/helpers.js:54

  for (const [prefix, ownerTarget] of Object.entries(PLATFORM_SOURCE_PATH_OWNERS)) {
    if (normalizedPath === prefix || normalizedPath.startsWith(`${prefix}/`)) {
      return ownerTarget !== adapterTarget;
    }
  }

  return false;
}

function resolveBaseRoot(scope, input = {}) {
  if (scope === 'home') {
    return input.homeDir || os.homedir();
  }

  if (scope === 'project') {
    const projectRoot = input.projectRoot || input.repoRoot;
    if (!projectRoot) {
      throw new Error('projectRoot or repoRoot is required for project install targets');
    }
    return projectRoot;
  }

  throw new Error(`Unsupported install target scope: ${scope}`);
}

function buildValidationIssue(severity, code, message, extra = {}) {
  return {
    severity,
    code,
    message,
    ...extra,
  };
}

function listRelativeFiles(dirPath, prefix = '') {
  if (!fs.existsSync(dirPath)) {

View on GitHub (pinned to 8321021c54)