Skip to content

GET /v2/projects_random almost never returns the requested number of projects #2658

Closed
@Zechiax

Description

@Zechiax

Describe the bug

The projects_random endpoint on the Modrinth API is not returning the expected number of projects requested. When requesting a certain number of random projects through the endpoint, the number of projects returned is almost always lower than the requested count.

For instance, when requesting a single project with the count parameter set to 1, the endpoint sometimes returns no projects. For example: https://api.modrinth.com/v2/projects_random?count=1

The docs specify the count as "The number of random projects to return"

Steps to reproduce

  1. Make a GET request to the projects_random endpoint with a count parameter set to a specific number.
  2. See the number of returned projects in the response.
  3. Repeat the request several times to confirm that the number of projects returned is consistently lower than the requested count.

Expected behavior

The endpoint should return a list of random projects, where the number of projects returned should always match the specified count.

Additional context

Empty response with count=1

empty

Response with count=20 but the number of returned projects is 3

lower

Metadata

Metadata

Assignees

No one assigned

    Labels

    backendRelates to Modrinth Backend or APIbugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions