Skip to content

Crash when adding contributors and there is no content before the all contributors comment tag #376

Closed

Description

@davepagurek

Describe the bug
At p5.js we just switched to having our contributors list in a separate file because it was getting quite large. We noticed after doing this that the all-contributors bot stopped being able to add contributors. The problem could be reproduced with the all-contributors CLI locally too. It worked correctly again after adding a title to the markdown file.

To Reproduce
Steps to reproduce the behavior:

  1. Create CONTRIBUTORS.md that looks like this, with nothing at the top of the file before the comment:

    <!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
    <!-- prettier-ignore-start -->
    <!-- markdownlint-disable -->
    
    <!-- markdownlint-restore -->
    <!-- prettier-ignore-end -->
    <!-- ALL-CONTRIBUTORS-LIST:END -->
  2. In .all-contributorsrc, point to that file:

    "files": [
       "CONTRIBUTORS.md"
     ],
  3. Run all-contributors add someusername code to try to add a contributor

  4. I get this error:

  RangeError: Invalid count value: -1
      at String.repeat (<anonymous>)
      at /usr/local/lib/node_modules/all-contributors-cli/dist/generate/index.js:19:186
      at /usr/local/lib/node_modules/all-contributors-cli/node_modules/lodash/lodash.min.js:57:276
      at module.exports (/usr/local/lib/node_modules/all-contributors-cli/dist/generate/index.js:75:78)
      at /usr/local/lib/node_modules/all-contributors-cli/dist/cli.js:33:28
      at async Promise.all (index 0)

Expected behavior
It should be able to add an entry to the table.

Additional context
Adding anything beforehand, e.g. a title to the markdown file, makes it work.

I think there's just an assumption that there is content before, so it tries to index a string at index -1. Maybe wrapping in Math.max(idx, 0) would be sufficient.

Activity

  1. added
    type: bug
    on Nov 6, 2025
  2. lwasser commented on Jan 27, 2026

    @lwasser
    Member

    @all-contributors please add @davepagurek for bug

    Hey there @davepagurek 👋🏻 i just wanted to drop in and say hello, and let you know that we are currently rebooting this project. The last release on NPM is ~3 years old, I think, and we need to update the infrastructure first. Right now i do know that the build from main branch is also broken but we are working on fixing this all, updating dependencies, etc. i've noted that this is a bug and once we upgrage some of the infra, revisit the tests and such and get everything working and secure again, we will come back to some of these bugs and try to sort those out as well! thank you so much for opening this issue!!

  3. allcontributors commented on Jan 27, 2026

    @allcontributors
    Contributor

    @lwasser

    I've put up a pull request to add @davepagurek! 🎉

  4. added a commit that references this issue on Oct 22, 2026
    34d63ca
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions