can1357/oh-my-pi · error · GitHubError
proxy returned malformed review_comment payload
Error message
proxy returned malformed review_comment payload
What it means
GitHubError(500) raised by _review_comment_from when a PR review-comment payload from the proxy is not a JSON object. Each review comment must be a dict; a non-dict element aborts listing review comments for the PR.
Source
Thrown at python/robomp/src/proxy_client.py:684
author=str(data.get("author") or ""),
body=str(data.get("body") or ""),
created_at=str(data.get("created_at") or ""),
)
def _reaction_from(data: Any) -> ReactionInfo:
if not isinstance(data, dict):
raise GitHubError(500, "proxy returned malformed reaction payload")
return ReactionInfo(
content=str(data.get("content") or ""),
user_login=str(data.get("user_login") or ""),
user_type=str(data.get("user_type") or ""),
)
def _review_comment_from(data: Any) -> ReviewCommentInfo:
if not isinstance(data, dict):
raise GitHubError(500, "proxy returned malformed review_comment payload")
line = data.get("line")
return ReviewCommentInfo(
id=int(data.get("id") or 0),
author=str(data.get("author") or ""),
body=str(data.get("body") or ""),
path=str(data.get("path") or ""),
line=line if isinstance(line, int) else None,
created_at=str(data.get("created_at") or ""),
)
def _pr_review_from(data: Any) -> PullRequestReviewInfo:
if not isinstance(data, dict):
raise GitHubError(500, "proxy returned malformed pr_review payload")
return PullRequestReviewInfo(
id=int(data.get("id") or 0),
author=str(data.get("author") or ""),
body=str(data.get("body") or ""),View on GitHub (pinned to 9690622007)
Solutions
- Inspect the raw review-comments response from the proxy to identify the malformed element.
- Check proxy version compatibility; redeploy/upgrade the proxy to match the client schema.
- Check proxy logs for upstream GitHub errors on the review-comments endpoint being passed through unshaped.
- Retry the call; if persistent, fall back to fetching review comments through list_pr_reviews and client-side assembly.
- Report the malformed element (with its position in the array) to the proxy maintainers.
Example fix
# before
comments = client.list_review_comments("org/repo", pr_number) # GitHubError 500
# after
try:
comments = client.list_review_comments("org/repo", pr_number)
except GitHubError as e:
if e.status == 500:
comments = [] # proceed without inline review comments
else:
raise Defensive patterns
Strategy: try-catch
Validate before calling
raw = resp.json()
items = raw if isinstance(raw, list) else []
if any(not isinstance(x, dict) for x in items):
raise RuntimeError("proxy returned non-object review-comment entries") Type guard
def is_review_comment(data: object) -> bool:
return isinstance(data, dict) and "id" in data and "path" in data Try / catch
try:
comments = client.list_review_comments("org/repo", pr)
except GitHubError as e:
if e.status == 500 and "malformed review_comment payload" in str(e):
comments = [] # proceed without inline comments
else:
raise Prevention
- Check the proxy for null entries when review files are deleted by force-push.
- Keep proxy and client review-comment schema versions aligned.
- Log raw responses on 5xx for post-mortem of proxy contract breaks.
- Fall back to parsing reviews via list_pr_reviews when inline comments fail.
When it happens
Trigger: Calling list_review_comments() when the proxy returns a reviews/comments array containing null, strings, or other scalars instead of review-comment objects.
Common situations: Proxy emitting null for review comments on files that were deleted in a force-push; stale proxy version with a different review-comment envelope; gateway rewriting bodies; upstream GitHub error leaking through as a scalar.
Understand the failure class
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
Related errors
- proxy returned malformed pr_review payload
- proxy returned malformed pr_file payload
- proxy returned malformed pr payload
- proxy returned malformed issue payload
- proxy returned malformed issue summary payload
AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31).
Data as JSON: /api/errors/0a84c19dda0f6e3a.
Report an issue: GitHub.