666ghj/MiroFish · error · StarHistoryError
GitHub GraphQL returned an invalid star timestamp
Error message
GitHub GraphQL returned an invalid star timestamp
What it means
An edge's starredAt field was not a string. starredAt is required to place each star on the history timeline, so a non-string value (null, number, object) raises StarHistoryError('GitHub GraphQL returned an invalid star timestamp') before _parse_github_timestamp is attempted (that function only accepts str).
Source
Thrown at scripts/star_history.py:280
total_count = _strict_non_negative_int(
stargazers.get("totalCount"), "GraphQL totalCount"
)
rate_remaining = _strict_non_negative_int(
rate_limit.get("remaining"), "GraphQL rate remaining"
)
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,
)View on GitHub (pinned to b5b53acc57)
Solutions
- Ensure the query selects starredAt on every edge
- Fix fixtures to use ISO 8601 strings like '2024-01-15T10:30:00Z'
- Log the edge to confirm which value type arrived
Example fix
// before
edges { cursor }
// after
edges { cursor starredAt } Defensive patterns
Strategy: validation
Validate before calling
if not all(isinstance(e.get("starredAt"), str) for e in raw_edges if isinstance(e, dict)):
raise StarHistoryError("edges missing starredAt; query must select starredAt") Type guard
def edge_has_starred_at(edge: object) -> TypeGuard[dict]:
return isinstance(edge, dict) and isinstance(edge.get("starredAt"), str) Try / catch
try:
page = _parse_graphql_page(payload)
except StarHistoryError as exc:
if "invalid star timestamp" in str(exc) and "type" not in str(exc):
raise StarHistoryError("cannot place stars on timeline without starredAt") from exc
raise Prevention
- Keep `starredAt` in the query selection; it is required for the history timeline
- Validate fixture edges with the same guard as production code so tests catch missing fields
When it happens
Trigger: Edge with starredAt: null (field not selected in the query, or edge for an invisible user), or a fixture where starredAt was replaced by an epoch number.
Common situations: Query edited to drop the starredAt selection; hand-written fixtures; GitHub schema change renaming the field (e.g. to starred_at).
Related errors
- GitHub GraphQL edges were not a list
- GitHub GraphQL returned an invalid edge
- GitHub GraphQL returned an invalid edge cursor
- GitHub GraphQL returned invalid page information
- GitHub GraphQL returned an invalid page cursor
AI-assisted analysis of 666ghj/MiroFish@b5b53acc57 (2026-08-14).
Data as JSON: /api/errors/535388e452fc0000.
Report an issue: GitHub.