Skip to content

max_retries=0 raises ValueError on every request #1139

Closed

Description

@vdusek

ApifyClient(max_retries=0) is accepted (_apify_client.py#L122, #L143), but every call then fails with ValueError('max_retries must be at least 1, got 0') from the retry loop (_base.py#L594-L624, async at #L821-L851). The loop makes max_retries attempts and then one more, so max_retries counts retries and 0 would mean a single attempt. As it stands, there is no way to turn retries off.

The JS client accepts any non-negative integer (base.ts#L57) and uses the same attempt loop (base.ts#L515-L534).

Expected behavior

max_retries=0 makes one attempt with no retries. A negative value is rejected in the constructor, not on the first request.

✍️ Drafted by Claude Code

Activity

  1. added
    bugSomething isn't working.
    t-toolingIssues with this label are in the ownership of the tooling team.
    on Oct 16, 2026
  2. self-assigned this
    on Oct 16, 2026
  3. added a commit that references this issue on Oct 16, 2026
    3b128d1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working.t-toolingIssues with this label are in the ownership of the tooling team.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions