{"record":{"id":"24b6e28f9a1267fd","repo":"angular/angular-cli","slug":"the-best-practices-guide-at-guidepath-is-larg","errorCode":null,"errorMessage":"The best practices guide at '${guidePath}' is larger than 1MB (${stats.size} bytes). This is unexpected and the file will not be read. Falling back to the bundled guide.","messagePattern":"The best practices guide at '(.+?)' is larger than 1MB \\((.+?) bytes\\)\\. This is unexpected and the file will not be read\\. Falling back to the bundled guide\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packages/angular/cli/src/commands/mcp/tools/best-practices.ts","lineNumber":166,"sourceCode":"      // Ensure the resolved guide path is within the package boundary.\n      // Uses path.relative to create a cross-platform, case-insensitive check.\n      // If the relative path starts with '..' or is absolute, it is a traversal attempt.\n      const relativePath = relative(packageDirectory, guidePath);\n      if (relativePath.startsWith('..') || isAbsolute(relativePath)) {\n        logger.warn(\n          `Detected a potential path traversal attempt in '${pkgJsonPath}'. ` +\n            `The path '${bestPracticesInfo.path}' escapes the package boundary. ` +\n            'Falling back to the bundled guide.',\n        );\n\n        return undefined;\n      }\n\n      // Check the file size to prevent reading a very large file.\n      const stats = await stat(guidePath);\n      if (stats.size > 1024 * 1024) {\n        // 1MB\n        logger.warn(\n          `The best practices guide at '${guidePath}' is larger than 1MB (${stats.size} bytes). ` +\n            'This is unexpected and the file will not be read. Falling back to the bundled guide.',\n        );\n\n        return undefined;\n      }\n\n      const content = await readFile(guidePath, 'utf-8');\n      const source = `framework version ${pkgJson.version}`;\n\n      return { content, source };\n    } else {\n      logger.warn(\n        `Did not find valid 'angular.bestPractices' metadata in '${pkgJsonPath}'. ` +\n          'Falling back to the bundled guide.',\n      );\n    }\n  } catch (e) {","sourceCodeStart":148,"sourceCodeEnd":184,"githubUrl":"https://github.com/angular/angular-cli/blob/bb72145f9ab45aee29f523236b3a25cd0813a841/packages/angular/cli/src/commands/mcp/tools/best-practices.ts#L148-L184","documentation":"The Angular CLI MCP best-practices tool looks for a version-specific guide referenced in the installed @angular/core package's 'angular.bestPractices' metadata. Before reading that file it stats it, and if the file exceeds 1MB it refuses to read it (a sanity check against corrupted or abnormally large files) and logs this warning, falling back to the guide bundled with the CLI.","triggerScenarios":"Calling the MCP best-practices tool when the installed @angular/core package declares an 'angular.bestPractices' file whose size, per stat(), is greater than 1024*1024 bytes; getVersionSpecificBestPractices then returns undefined and the bundled guide is used.","commonSituations":"A corrupted or tampered @angular/core installation (e.g., interrupted npm install, patched node_modules, pnpm store corruption) where the guide file ballooned past 1MB; custom forked Angular builds that ship an oversized guide.","solutions":["Reinstall @angular/core (delete node_modules and package-lock.json, then npm install) to restore the intact guide file.","Check the file size at the guidePath shown in the warning (find 'angular.bestPractices' in node_modules/@angular/core/package.json) and inspect why it is oversized.","Ignore the warning if acceptable: the CLI automatically falls back to its bundled best-practices guide.","If using a forked/patched Angular build, keep the best-practices markdown file under 1MB."],"exampleFix":"// before: oversized or corrupted guide in node_modules/@angular/core\n// after:\nrm -rf node_modules package-lock.json\nnpm install","handlingStrategy":"fallback","validationCode":"import { stat } from 'node:fs/promises';\nconst meta = pkgJson.angular?.bestPractices;\nif (meta?.path) {\n  const guidePath = resolve(pkgDir, meta.path);\n  const stats = await stat(guidePath);\n  if (stats.size > 1024 * 1024) console.warn('Guide oversized; bundled guide will be used');\n}","typeGuard":"function hasValidGuideMeta(pkg: unknown): pkg is { angular: { bestPractices: { path: string } } } {\n  const m = (pkg as any)?.angular?.bestPractices;\n  return !!m && typeof m.path === 'string' && m.path.length > 0;\n}","tryCatchPattern":"try {\n  const guide = await loadGuide(guidePath);\n} catch (err) {\n  logger.warn(`Guide load failed (${err}); using bundled guide`);\n  guide = bundledGuide;\n}","preventionTips":["Reinstall node_modules cleanly rather than hand-patching packages.","Verify integrity with `npm ci` or lockfile-based installs.","Keep any custom framework guide files under 1MB.","Treat this warning as non-fatal: the bundled guide still loads."],"tags":["mcp","filesystem","fallback","angular-cli"],"backgroundTag":"file-too-large-fallback","analyzedSha":"bb72145f9ab45aee29f523236b3a25cd0813a841","analyzedAt":"2026-08-30T02:47:34.745Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}