666ghj/MiroFish · error · StarHistoryError
GitHub GraphQL returned invalid page information
Error message
GitHub GraphQL returned invalid page information
What it means
pageInfo.hasNextPage was not exactly a bool (checked with type(...) is not bool, so 1/0/'true' are rejected too). The pagination loop decides whether to issue another request from this flag, so a non-bool raises StarHistoryError('GitHub GraphQL returned invalid page information').
Source
Thrown at scripts/star_history.py:286
if not isinstance(raw_edges, list):
raise StarHistoryError("GitHub GraphQL edges were not a list")
edges: list[StargazerEdge] = []
for raw_edge in raw_edges:
if not isinstance(raw_edge, dict):
raise StarHistoryError("GitHub GraphQL returned an invalid edge")
cursor = raw_edge.get("cursor")
starred_at = raw_edge.get("starredAt")
if not isinstance(cursor, str) or not cursor:
raise StarHistoryError("GitHub GraphQL returned an invalid edge cursor")
if not isinstance(starred_at, str):
raise StarHistoryError("GitHub GraphQL returned an invalid star timestamp")
edges.append(StargazerEdge(cursor, _parse_github_timestamp(starred_at)))
has_next_page = page_info.get("hasNextPage")
end_cursor = page_info.get("endCursor")
if type(has_next_page) is not bool:
raise StarHistoryError("GitHub GraphQL returned invalid page information")
if end_cursor is not None and not isinstance(end_cursor, str):
raise StarHistoryError("GitHub GraphQL returned an invalid page cursor")
if has_next_page and not end_cursor:
raise StarHistoryError("GitHub GraphQL omitted the next page cursor")
return StargazerPage(
total_count=total_count,
edges=tuple(edges),
has_next_page=has_next_page,
end_cursor=end_cursor,
rate_remaining=rate_remaining,
)
def _strict_non_negative_int(value: Any, label: str) -> int:
if type(value) is not int or value < 0:
raise StarHistoryError(f"{label} must be a non-negative integer")
return valueView on GitHub (pinned to b5b53acc57)
Solutions
- Ensure the query selects pageInfo { hasNextPage endCursor }
- Fix fixtures to use real JSON booleans (true/false, not 1/0 or quoted strings)
- Log page_info to see the raw value when it fires
Example fix
// before (fixture)
"pageInfo": {"hasNextPage": 1}
// after (fixture)
"pageInfo": {"hasNextPage": true, "endCursor": "abc"} Defensive patterns
Strategy: validation
Validate before calling
page_info = payload["data"]["repository"]["stargazers"].get("pageInfo", {})
if type(page_info.get("hasNextPage")) is not bool:
raise StarHistoryError("pageInfo.hasNextPage missing or not a JSON boolean") Type guard
def page_info_is_valid(page_info: object) -> TypeGuard[dict]:
return (
isinstance(page_info, dict)
and type(page_info.get("hasNextPage")) is bool
and (page_info.get("endCursor") is None or isinstance(page_info["endCursor"], str))
) Try / catch
try:
page = _parse_graphql_page(payload)
except StarHistoryError as exc:
if "invalid page information" in str(exc):
raise StarHistoryError("cannot decide whether more pages exist; halting pagination") from exc
raise Prevention
- Always request pageInfo { hasNextPage endCursor } in paginated queries
- Use real JSON booleans in fixtures — 1/0 and 'true' are rejected by strict type checks
When it happens
Trigger: A response where pageInfo is missing hasNextPage (None), or a hand-crafted fixture that used 1/0, 'true'/'false', or the string 'True' instead of a JSON boolean.
Common situations: Test fixtures written in JSON with truthy integers; a stub server serializing Python bools as ints; the query dropping pageInfo { hasNextPage }.
Related errors
- GitHub GraphQL returned an invalid edge cursor
- GitHub GraphQL returned an invalid page cursor
- GitHub GraphQL omitted the next page cursor
- GitHub returned an invalid pagination cursor
- GitHub GraphQL edges were not a list
AI-assisted analysis of 666ghj/MiroFish@b5b53acc57 (2026-08-14).
Data as JSON: /api/errors/0689e32c86e5c0cb.
Report an issue: GitHub.