Skip to content

apify actors search --limit 1 returns empty items[] — root cause is /v2/store API paging #1164

@ttokttokttok

Description

@ttokttokttok

Summary

apify actors search --limit 1 returns count: 1 with an empty items[] array, even though matches exist. More broadly: count always equals the requested --limit, not the number of Actors actually returned, and the deficit grows with --offset.

Reproduced directly against https://api.apify.com/v2/store with curl, so this is an API issue, not a CLI bug — but filing here because there's no public issue tracker for the API. Happy to be redirected to the right team if there's a better venue.

Repro via the CLI

$ npx apify actors search test --json --limit 1
{
"total": 18737,
"count": 1,
"offset": 0,
"limit": 1,
"items": [] ← empty despite total: 18737
}

Same pattern at --limit 5 shows the deficit grows with --offset:

--offset --limit count items.length missing
0 5 5 4 1
5 5 5 2 3
10 5 5 1 4

Repro at the API level (CLI-independent)

$ curl -s "https://api.apify.com/v2/store?search=test&limit=1"
{"data":{"total":18737,"count":1,"offset":0,"limit":1,"items":[]}}

$ curl -s "https://api.apify.com/v2/store?search=test&limit=1&offset=1"
{"data":{"total":18737,"count":1,"offset":1,"limit":1,"items":[{"name":"axe-accessibility-tester",...}]}}

The offset-0 result is consistently missing on first-page requests that have any filtered survivors.

Likely cause (inferred — please verify)

  • count is computed before page filtering (echoes min(limit, total - offset))
  • Items are filtered after the page window is selected, and the window is never refilled
  • So count reports the slot count and items.length reports survivors; they drift apart

Expected behaviour

  • count should equal items.length for the returned page
  • A request with limit ≥ 1, offset = 0, and total > 0 must return the top result, not an empty array
  • If items are filtered out post-window, the page should be refilled up to limit

Impact

Agents and scripts that branch on count or total to decide "did we find anything?" will incorrectly conclude no Actors matched, then either thrash on alternative searches or fall through to building a new Actor when one already exists. The top-ranked Actor at offset 0 is also unreachable on any first-page request whenever there are filtered survivors — worst possible item to drop.

Workaround

Use --limit 10 (or higher) for any discovery use case, and trust items[] over count. Treat empty items[] as the only true "no results" signal.

Environment

  • apify-cli/1.6.1 (commit 91d9a13), Node 24.11.1, Windows
  • Reproduced against api.apify.com on 2026-05-28

Metadata

Metadata

Assignees

No one assigned

    Labels

    t-dxIssues owned by the DX team.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions