{"record":{"id":"8869c5162c1b7079","repo":"Egonex-AI/Understand-Anything","slug":"import-extraction-reported-failures-preview-s","errorCode":null,"errorMessage":"Import extraction reported failures: ${preview}${suffix}","messagePattern":"Import extraction reported failures: (.+?)(.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"understand-anything-plugin/skills/understand/prepare-incremental.mjs","lineNumber":405,"sourceCode":"\nfunction refreshImportMap({ projectRoot, intermediateDir, previousScan, currentScan, analysisPaths }) {\n  const inputPath = join(intermediateDir, 'incremental-import-input.json');\n  const outputPath = join(intermediateDir, 'incremental-import-output.json');\n  atomicWriteJson(inputPath, {\n    projectRoot,\n    files: currentScan.files,\n    analysisPaths,\n  });\n  run(process.execPath, [IMPORT_SCRIPT, inputPath, outputPath]);\n  const extraction = readJson(outputPath);\n  const failures = Array.isArray(extraction?.failures) ? extraction.failures : [];\n  if (failures.length > 0) {\n    const preview = failures\n      .slice(0, 5)\n      .map(failure => `${failure.path ?? '<global>'} (${failure.stage})`)\n      .join(', ');\n    const suffix = failures.length > 5 ? ` (+${failures.length - 5} more)` : '';\n    throw new Error(`Import extraction reported failures: ${preview}${suffix}`);\n  }\n  const selective = extraction?.importMap ?? {};\n  const currentPaths = new Set(currentScan.files.map(file => file.path));\n  const importMap = {};\n  for (const file of currentScan.files) {\n    const path = file.path;\n    const candidate = Object.hasOwn(selective, path)\n      ? selective[path]\n      : previousScan?.importMap?.[path];\n    importMap[path] = Array.isArray(candidate)\n      ? sorted(candidate.filter(target => typeof target === 'string' && currentPaths.has(target)))\n      : [];\n  }\n  return importMap;\n}\n\nfunction pruneExistingGraph(graph, pathsToReplace, importPathsToRefresh = new Set()) {\n  const removedNodeIds = new Set();","sourceCodeStart":387,"sourceCodeEnd":423,"githubUrl":"https://github.com/Egonex-AI/Understand-Anything/blob/07edf82a04371b6f69779b067bdc8a1a8753a9db/understand-anything-plugin/skills/understand/prepare-incremental.mjs#L387-L423","documentation":"refreshImportMap runs import extraction and collects per-file failures with a stage label. If any failure occurred it refuses to proceed, because a partial import map would produce an incomplete or wrong dependency graph for the incremental update.","triggerScenarios":"The import-extraction step returns an extraction object whose failures array is non-empty — e.g. files with syntax the extractor cannot parse, unreadable files, or a global extraction-stage error.","commonSituations":"Recently added source files in a syntax the extractor does not support, files deleted between scan and extraction, extractor version drift after a plugin update, or corrupt/unparseable source committed to the repo.","solutions":["Inspect the failure preview in the message — it lists path and stage for each failing file","Fix or exclude the listed files (--exclude <patterns>) if they are irrelevant","Re-run after confirming the files parse correctly; transient states (mid-edit files) resolve on retry","If extraction is systematically failing after an update, re-run the full /understand pipeline to rebuild the import map"],"exampleFix":"// before\nif (failures.length > 0) {\n  throw new Error(`Import extraction reported failures: ${preview}${suffix}`);\n}\n// after\nif (failures.length > 0) {\n  console.warn(`Import extraction failures (proceeding): ${preview}${suffix}`);\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":"function extractionSucceeded(extraction) { return extraction && Array.isArray(extraction.failures) && extraction.failures.length === 0; }","tryCatchPattern":"try {\n  await prepareIncremental(args);\n} catch (err) {\n  if (String(err.message).startsWith('Import extraction reported failures')) {\n    console.error(err.message); // lists failing paths + stages\n    // fix/exclude listed files, or fall back to full analysis\n  }\n  throw err;\n}","preventionTips":["Fix or --exclude files with syntax the extractor cannot parse","Avoid running incremental prep while files are mid-edit or half-written","After plugin/version updates, run a full analysis once to rebuild the import map"],"tags":["parsing","imports","incremental-analysis"],"backgroundTag":"unexpected-api-response-shape","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"}