666ghj/MiroFish · error · StarHistoryError
GitHub GraphQL returned no pages
Error message
GitHub GraphQL returned no pages
What it means
Raised at scripts/star_history.py:607 immediately after the backfill pagination loop: if `initial_total` is still None, the `while True` loop never completed even one `github.fetch_stargazer_page()` call that reached the total-count assignment. It is a defensive assertion that should be unreachable in practice (the loop always executes at least once or raises earlier), guarding against control-flow regressions.
Source
Thrown at scripts/star_history.py:607
raise StarHistoryError("GitHub GraphQL repeated an edge cursor")
seen_edge_cursors.add(edge.cursor)
if edge.starred_at.date() < normalized_now.date():
daily_increments[edge.starred_at.date()] += 1
if page.end_cursor is not None:
if page.end_cursor in seen_page_cursors:
raise StarHistoryError("GitHub GraphQL repeated a page cursor")
seen_page_cursors.add(page.end_cursor)
if not page.has_next_page:
break
if page.end_cursor is None:
raise StarHistoryError("GitHub GraphQL omitted the next page cursor")
after = page.end_cursor
if page_number > 10_000:
raise StarHistoryError("GitHub GraphQL exceeded the page safety limit")
if initial_total is None:
raise StarHistoryError("GitHub GraphQL returned no pages")
if len(seen_edge_cursors) != initial_total:
raise StarHistoryError("stargazer list changed or was incomplete during backfill")
running = 0
daily: list[dict[str, Any]] = []
for point_day in sorted(daily_increments):
running += daily_increments[point_day]
daily.append({"date": point_day.isoformat(), "stars": running})
state: dict[str, Any] = {
"schema_version": 1,
"repository": REPOSITORY,
"timezone": "UTC",
"ongoing_interval_days": INTERVAL_DAYS,
"reconstruction": {
"method": "current_stargazers_starred_at",
"generated_at": _format_state_timestamp(normalized_now),
"daily": daily,View on GitHub (pinned to b5b53acc57)
Solutions
- If you hit this after modifying the backfill loop, restore the invariant: the first `fetch_stargazer_page` result must set `initial_total` and `pages_required` before any `continue`/`break`.
- Run the repository's test suite for scripts/star_history.py — this assertion exists to make loop refactorings fail loudly.
- If untouched code raises it, report a control-flow bug; include the traceback showing how the loop exited without an exception.
Defensive patterns
Strategy: try-catch
Try / catch
try:
state = run_backfill(gateway, clock)
except StarHistoryError as exc:
if "returned no pages" in str(exc):
raise RuntimeError("control-flow bug in backfill loop; report upstream") from exc
raise Prevention
- Do not refactor the backfill loop without running its full test suite — this assertion exists to catch structural regressions.
- Keep the initial_total assignment unconditional on the first page fetch if you must restructure the loop.
- Never wrap fetch_stargazer_page in an exception swallower that could let the loop `continue` past the assignment.
When it happens
Trigger: Structurally unreachable via the public API: the loop body unconditionally sets `initial_total = page.total_count` on the first iteration, and every exit path from the loop either goes through `break` (after ≥1 page) or raises a different StarHistoryError. Only a refactoring bug (e.g. a future `continue` before the assignment, or an exception-swallowing wrapper) can leave `initial_total` None at line 607.
Common situations: Essentially never seen in production; appears only when someone edits the loop structure (moving the `initial_total` assignment behind a condition) or in mutant/coverage tests that exercise the dead branch.
Related errors
- 无法处理的文件格式: {suffix}
- GitHub GraphQL repeated an edge cursor
- GitHub GraphQL repeated a page cursor
- GitHub GraphQL exceeded the page safety limit
- stargazer list changed or was incomplete during backfill
AI-assisted analysis of 666ghj/MiroFish@b5b53acc57 (2026-08-14).
Data as JSON: /api/errors/37b2b6881357d203.
Report an issue: GitHub.