{"record":{"id":"af60f93a6cdc98cb","repo":"oven-sh/bun","slug":"could-not-find-contributing-in-readme","errorCode":null,"errorMessage":"Could not find ## Contributing in README","messagePattern":"Could not find ## Contributing in README","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/nav2readme.ts","lineNumber":89,"sourceCode":"    }\n    md +=\n      `  - [${name}](https://bun.com/guides/${path.dirname(file)}/${path.basename(file, path.extname(file))})` + \"\\n\";\n  }\n\n  return md;\n}\n\nconst text = await Bun.file(Bun.fileURLToPath(import.meta.resolve(\"../README.md\"))).text();\nconst startI = text.indexOf(\"## Quick links\\n\");\nif (startI === -1) {\n  throw new Error(\"Could not find ## Quick links in README\");\n}\nconst start = startI + \"## Quick links\\n\".length;\n\nconst contributing = text.indexOf(\"## Contributing\\n\", start);\n\nif (contributing === -1) {\n  throw new Error(\"Could not find ## Contributing in README\");\n}\n\nconst guides = await getGuides();\n\nconst combined =\n  [text.slice(0, start), getQuickLinks(), guides, text.slice(contributing)].map(text => text.trim()).join(\"\\n\\n\") +\n  \"\\n\";\n\nawait Bun.write(Bun.fileURLToPath(import.meta.resolve(\"../README.md\")), combined);\n\nfunction normalizeSectionName(name: string) {\n  if (name.includes(\"-\")) {\n    return name\n      .split(\"-\")\n      .map((s, i) => (i === 0 ? s.charAt(0).toUpperCase() + s.slice(1) : s))\n      .join(\" \");\n  }\n","sourceCodeStart":71,"sourceCodeEnd":107,"githubUrl":"https://github.com/oven-sh/bun/blob/8c5296ac459e8252d3cd702f3fbcbb0c249d95d5/scripts/nav2readme.ts#L71-L107","documentation":"nav2readme.ts searches for `## Contributing\\n` starting after the Quick links heading, to find where the injected guides block must end. If the heading is absent (or only appears before Quick links), indexOf returns -1 and the script aborts before rewriting the README.","triggerScenarios":"The Contributing heading was renamed, removed, or moved above the Quick links section; CRLF line endings break the `\\n` match just like the other sentinel.","commonSituations":"README reorganizations that move Contributing to a separate file; section renames (`## Getting involved`); Windows CRLF checkouts.","solutions":["Ensure `## Contributing` exists in README.md below the `## Quick links` section, spelled exactly","Convert the README to LF line endings","Re-run `bun scripts/nav2readme.ts` after fixing; it rewrites between the two sentinels"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const readme = await Bun.file(\"README.md\").text();\nconst quick = readme.indexOf(\"## Quick links\\n\");\nif (quick === -1 || readme.indexOf(\"## Contributing\\n\", quick) === -1) {\n  throw new Error(\"README.md is missing a `## Contributing` heading after `## Quick links` — nav2readme would abort\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Preserve section order: Quick links must precede Contributing","Cover both sentinels in one pre-check before running the generator"],"tags":["docs","readme","automation","markdown"],"backgroundTag":null,"analyzedSha":"8c5296ac459e8252d3cd702f3fbcbb0c249d95d5","analyzedAt":"2026-08-16T08:01:58.794Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}