{"record":{"id":"e25de20a5a3f17a3","repo":"Egonex-AI/Understand-Anything","slug":"invalid-input-analysispaths-entry-is-not-present","errorCode":null,"errorMessage":"Invalid input: analysisPaths entry is not present in files: ${rawPath}","messagePattern":"Invalid input: analysisPaths entry is not present in files: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"understand-anything-plugin/skills/understand/extract-import-map.mjs","lineNumber":143,"sourceCode":"  const selected = [];\n  const seen = new Set();\n  for (const rawPath of analysisPaths) {\n    if (typeof rawPath !== 'string' || rawPath.length === 0) {\n      throw new Error('Invalid input: every analysisPaths entry must be a non-empty string');\n    }\n    // Use the host's path semantics here. On POSIX, backslashes and drive-like\n    // prefixes are ordinary project-relative filename characters; on Windows,\n    // path.isAbsolute also rejects drive-rooted and root-relative paths.\n    if (isAbsolute(rawPath)) {\n      throw new Error(`Invalid input: analysisPaths entry must be project-relative: ${rawPath}`);\n    }\n    const path = toPosix(rawPath);\n    if (!path || path.split('/').some(part => part === '..')) {\n      throw new Error(`Invalid input: analysisPaths entry escapes projectRoot: ${rawPath}`);\n    }\n    const file = filesByPath.get(path);\n    if (!file) {\n      throw new Error(`Invalid input: analysisPaths entry is not present in files: ${rawPath}`);\n    }\n    if (!seen.has(path)) {\n      seen.add(path);\n      selected.push(file);\n    }\n  }\n  return selected;\n}\n\n// ECMAScript relational string comparison is lexicographic over UTF-16 code\n// units, so path ordering is stable across ICU versions, locales, and hosts.\nfunction comparePaths(a, b) {\n  if (a === b) return 0;\n  return a < b ? -1 : 1;\n}\n\n/**\n * Join a directory with a relative segment, normalizing `.`/`..` segments and","sourceCodeStart":125,"sourceCodeEnd":161,"githubUrl":"https://github.com/Egonex-AI/Understand-Anything/blob/07edf82a04371b6f69779b067bdc8a1a8753a9db/understand-anything-plugin/skills/understand/extract-import-map.mjs#L125-L161","documentation":"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.","triggerScenarios":"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.","commonSituations":"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\".","solutions":["Regenerate the `files` array from a fresh scan so it includes every path referenced by analysisPaths.","Filter analysisPaths down to paths present in the current files inventory before invoking the script.","Compare entries against files[i].path exactly (after POSIX normalization) to catch casing, './' prefix, or separator mismatches."],"exampleFix":"// before\nconst input = { projectRoot, files: staleFiles, analysisPaths: plan.changedPaths };\n// after\nconst present = new Set(files.map(f => f.path));\nconst input = { projectRoot, files, analysisPaths: plan.changedPaths.filter(p => present.has(p)) };","handlingStrategy":"validation","validationCode":"const present = new Set(files.map(f => f.path.split('\\\\').join('/')));\nconst missing = analysisPaths.filter(p => !present.has(p.split('\\\\').join('/').replace(/^\\.\\//, '')));\nif (missing.length) throw new Error(`paths not in files inventory: ${missing.join(', ')}`);","typeGuard":"const inInventory = (p, files) => files.some(f => f.path.split('\\\\').join('/') === p.split('\\\\').join('/').replace(/^\\.\\//, ''));","tryCatchPattern":"try {\n  await runExtractor(input);\n} catch (err) {\n  if (String(err.message).includes('analysisPaths entry is not present in files')) {\n    const present = new Set(input.files.map(f => f.path));\n    input.analysisPaths = input.analysisPaths.filter(p => present.has(p));\n    await runExtractor(input);\n  } else throw err;\n}","preventionTips":["Intersect analysisPaths with the current files inventory before every incremental run.","Regenerate the files array in the same pipeline stage that computes changed paths so they can't drift apart.","Normalize separators and strip './' prefixes identically on both sides of the comparison."],"tags":["resource-not-found","stale-data","path-validation"],"backgroundTag":"resource-not-found","analyzedSha":"07edf82a04371b6f69779b067bdc8a1a8753a9db","analyzedAt":"2026-09-07T23:20:10.829Z","contentChangedAt":"2026-09-07T23:20:10.829Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}