Skip to content

Fix coauthor_counts.py crash: KeyError 'count' from get_all_notes - #13

Open
mmurshed wants to merge 1 commit into
JmlrOrg:mainfrom
mmurshed:fix-coauthor-counts-pagination
Open

Fix coauthor_counts.py crash: KeyError 'count' from get_all_notes#13
mmurshed wants to merge 1 commit into
JmlrOrg:mainfrom
mmurshed:fix-coauthor-counts-pagination

Conversation

@mmurshed

@mmurshed mmurshed commented Aug 6, 2026

Copy link
Copy Markdown

Problem

src/coauthor_counts.py crashes at startup for (at least some) authors:

  File ".../openreview/api/client.py", line 1122, in get_all_notes
    return tools.concurrent_get(self, self.get_notes, **params)
  File ".../openreview/tools.py", line 693, in concurrent_get
    _, count = get_function(**get_count_params)
  File ".../openreview/api/client.py", line 1024, in get_notes
    return notes, response.json()['count']
KeyError: 'count'

client.get_all_notes() delegates to tools.concurrent_get(), which first fires a with_count=True, limit=1 probe and unconditionally unpacks response.json()['count']. Against api2.openreview.net, the notes response for the content={'authorids': ...} query returns no count field, so the probe raises before any submission is fetched. Observed 2026-08-05 with openreview-py 1.27.3 (current PyPI release at the time).

Fix

Replace the get_all_notes() call with a small local helper that paginates via plain client.get_notes(offset=..., limit=1000, ...) — no count probe needed; the loop terminates when a batch comes back short. No other behaviour changes.

Verification

Run against a live author profile with one 2026 TMLR submission; before the patch the script crashes as above, after it prints the expected output:

[2026-08-04]   3 authors  <title>
1 TMLR submission(s) in 2026
Number of authors: 3

With the quota policy now counting desk-rejected and withdrawn submissions, this script is the only self-serve way for authors to audit their year — worth keeping runnable on the current openreview-py.

🤖 Generated with Claude Code

https://claude.ai/code/session_01YamLghkWSvYw1NzBhGChFf

client.get_all_notes() delegates to tools.concurrent_get(), which first
fires a with_count=True, limit=1 probe and unpacks response.json()['count'].
Against api2.openreview.net the notes response for this query carries no
'count' field (observed 2026-08-05 with openreview-py 1.27.3), so the
script crashes at startup:

    File ".../openreview/api/client.py", line 1024, in get_notes
      return notes, response.json()['count']
    KeyError: 'count'

Replace the call with plain offset pagination via client.get_notes(),
which needs no count probe. Behaviour is otherwise identical; verified
against a live author profile (returns the correct submission list).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YamLghkWSvYw1NzBhGChFf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant