Egonex-AI/Understand-Anything · error

Invalid input: analysisPaths entry is not present in files:

Error message

Invalid input: analysisPaths entry is not present in files: ${rawPath}

What it means

selectAnalysisFiles() looks each normalized analysisPaths entry up in a Map built from the input's `files` array and throws when no file with that path exists. The script requires selective analysis paths to reference files from the current inventory — a path that is not in `files` is treated as a caller bug (stale inventory or typo) rather than silently ignored.

Source

Thrown at understand-anything-plugin/skills/understand/extract-import-map.mjs:143

  const selected = [];
  const seen = new Set();
  for (const rawPath of analysisPaths) {
    if (typeof rawPath !== 'string' || rawPath.length === 0) {
      throw new Error('Invalid input: every analysisPaths entry must be a non-empty string');
    }
    // Use the host's path semantics here. On POSIX, backslashes and drive-like
    // prefixes are ordinary project-relative filename characters; on Windows,
    // path.isAbsolute also rejects drive-rooted and root-relative paths.
    if (isAbsolute(rawPath)) {
      throw new Error(`Invalid input: analysisPaths entry must be project-relative: ${rawPath}`);
    }
    const path = toPosix(rawPath);
    if (!path || path.split('/').some(part => part === '..')) {
      throw new Error(`Invalid input: analysisPaths entry escapes projectRoot: ${rawPath}`);
    }
    const file = filesByPath.get(path);
    if (!file) {
      throw new Error(`Invalid input: analysisPaths entry is not present in files: ${rawPath}`);
    }
    if (!seen.has(path)) {
      seen.add(path);
      selected.push(file);
    }
  }
  return selected;
}

// ECMAScript relational string comparison is lexicographic over UTF-16 code
// units, so path ordering is stable across ICU versions, locales, and hosts.
function comparePaths(a, b) {
  if (a === b) return 0;
  return a < b ? -1 : 1;
}

/**
 * Join a directory with a relative segment, normalizing `.`/`..` segments and

View on GitHub (pinned to 07edf82a04)

Solutions

  1. Regenerate the `files` array from a fresh scan so it includes every path referenced by analysisPaths.
  2. Filter analysisPaths down to paths present in the current files inventory before invoking the script.
  3. Compare entries against files[i].path exactly (after POSIX normalization) to catch casing, './' prefix, or separator mismatches.

Example fix

// before
const input = { projectRoot, files: staleFiles, analysisPaths: plan.changedPaths };
// after
const present = new Set(files.map(f => f.path));
const input = { projectRoot, files, analysisPaths: plan.changedPaths.filter(p => present.has(p)) };
Defensive patterns

Strategy: validation

Validate before calling

const present = new Set(files.map(f => f.path.split('\\').join('/')));
const missing = analysisPaths.filter(p => !present.has(p.split('\\').join('/').replace(/^\.\//, '')));
if (missing.length) throw new Error(`paths not in files inventory: ${missing.join(', ')}`);

Type guard

const inInventory = (p, files) => files.some(f => f.path.split('\\').join('/') === p.split('\\').join('/').replace(/^\.\//, ''));

Try / catch

try {
  await runExtractor(input);
} catch (err) {
  if (String(err.message).includes('analysisPaths entry is not present in files')) {
    const present = new Set(input.files.map(f => f.path));
    input.analysisPaths = input.analysisPaths.filter(p => present.has(p));
    await runExtractor(input);
  } else throw err;
}

Prevention

When it happens

Trigger: Passing an analysisPaths entry whose normalized form does not exactly match any files[i].path after toPosix() normalization — e.g. the file was deleted or renamed since the scan, the path has a leading "./" that the inventory lacks, casing differs on a case-sensitive filesystem, or the entry is a directory instead of a file.

Common situations: Incremental runs reuse an old incremental-plan.json listing files removed in the current commit; the caller generates paths with a different separator convention or casing than the scanner emitted; a typo like "src/indx.ts".

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


AI-assisted analysis of Egonex-AI/Understand-Anything@07edf82a04 (2026-09-07). Data as JSON: /api/errors/e25de20a5a3f17a3. Report an issue: GitHub.