{"record":{"id":"155bc8972b647ae4","repo":"microsoft/playwright-mcp","slug":"markers-for-generated-section-not-found-in-readme","errorCode":null,"errorMessage":"Markers for generated section not found in README","messagePattern":"Markers for generated section not found in README","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"update-readme.js","lineNumber":109,"sourceCode":"    lines.push(`  - Parameters: None`);\n  }\n  lines.push(`  - Read-only: **${tool.type === 'readOnly'}**`);\n  lines.push('');\n  return lines;\n}\n\n/**\n * @param {string} content\n * @param {string} startMarker\n * @param {string} endMarker\n * @param {string[]} generatedLines\n * @returns {Promise<string>}\n */\nasync function updateSection(content, startMarker, endMarker, generatedLines) {\n  const startMarkerIndex = content.indexOf(startMarker);\n  const endMarkerIndex = content.indexOf(endMarker);\n  if (startMarkerIndex === -1 || endMarkerIndex === -1)\n    throw new Error('Markers for generated section not found in README');\n\n  return [\n    content.slice(0, startMarkerIndex + startMarker.length),\n    '',\n    generatedLines.join('\\n'),\n    '',\n    content.slice(endMarkerIndex),\n  ].join('\\n');\n}\n\n/**\n * @param {string} content\n * @returns {Promise<string>}\n */\nasync function updateTools(content) {\n  console.log('Loading tool information from compiled modules...');\n\n  const generatedLines = /** @type {string[]} */ ([]);","sourceCodeStart":91,"sourceCodeEnd":127,"githubUrl":"https://github.com/microsoft/playwright-mcp/blob/16cf228d7b02c07f800ec3423f471ec2a42d22a9/update-readme.js#L91-L127","documentation":"update-readme.js regenerates README sections by locating HTML comment markers (`<!--- ... generated by ... -->` and `<!--- End of ... generated section -->`) inside README.md and splicing new content between them. `updateSection` throws this error when either the start or end marker string cannot be found via `indexOf`, meaning the README no longer contains intact, well-formed markers. It exists as a fail-fast guard so the script never silently appends duplicate sections or clobbers the wrong part of the doc.","triggerScenarios":"Running `node utils/update-readme.js` when README.md is missing a marker comment, has a typo in one (e.g. `<!---End of tools generated section -->` missing a space, or `--->`), has the markers reordered (end before start), or when a hand-edit accidentally deleted a marker line. Also triggered by tools that reformat/lint markdown and alter or strip the HTML comments.","commonSituations":"Manual edits to README.md that touch the generated sections; a merge conflict resolution that drops marker lines; Prettier/markdown formatters normalizing comment syntax; partial reverts where only one of the paired markers was removed.","solutions":["Restore both markers in README.md exactly as the script defines them: check the `startMarker`/`endMarker` template strings in update-readme.js (e.g. `<!--- Tools generated by update-readme.js -->` and `<!--- End of tools generated section -->`) and ensure each appears verbatim, in order, in the README.","If markers were lost, `git checkout HEAD -- README.md` (or copy them from an older tag) to recover the marker lines, then rerun the script.","Never hand-edit content between the markers; place custom prose outside the generated sections so formatters and edits don't disturb the markers."],"exampleFix":"# before (README.md) — end marker corrupted\n<!--- Tools generated by update-readme.js -->\n...old table...\n<!---End of tools generated section--->\n\n# after\n<!--- Tools generated by update-readme.js -->\n...old table...\n<!--- End of tools generated section -->","handlingStrategy":"try-catch","validationCode":"// Verify markers exist before invoking the generator:\nimport fs from 'fs';\n\nconst readme = fs.readFileSync('README.md', 'utf-8');\nconst markers = [\n  '<!--- Tools generated by update-readme.js -->',\n  '<!--- End of tools generated section -->',\n  '<!--- Config generated by update-readme.js -->',\n  '<!--- End of config generated section -->',\n];\nconst missing = markers.filter(m => !readme.includes(m));\nif (missing.length) {\n  console.error('README markers missing:', missing);\n  process.exit(1);\n}","typeGuard":"function hasGeneratedMarkers(readme, startMarker, endMarker) {\n  const s = readme.indexOf(startMarker);\n  const e = readme.indexOf(endMarker);\n  return s !== -1 && e !== -1 && s < e;\n}","tryCatchPattern":"try {\n  await updateReadme();\n} catch (e) {\n  if (/Markers for generated section not found/.test(e.message)) {\n    // restore markers from git rather than letting the script rewrite the README\n    execSync('git checkout HEAD -- README.md');\n    throw new Error('README markers were corrupted; restored from git. Re-apply manual edits outside generated sections.');\n  }\n  throw e;\n}","preventionTips":["Treat marker comments as code: never edit or reformat lines between them.","Add markdown formatter ignores (e.g. .prettierignore) for README.md or exclude HTML comments from formatting.","Pre-commit check that README.md still contains all four marker strings verbatim."],"tags":["build-script","readme","marker-parsing","markdown","developer-tooling"],"backgroundTag":"template-marker-not-found","analyzedSha":"16cf228d7b02c07f800ec3423f471ec2a42d22a9","analyzedAt":"2026-08-27T04:02:08.206Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}