can1357/oh-my-pi · error · GitHubError
proxy returned malformed pr_file payload
Error message
proxy returned malformed pr_file payload
What it means
GitHubError(500) raised by _pr_file_from when a PR file-diff payload from the proxy is not a JSON object. Each file entry (path, status, additions, deletions, patch) must be a dict; a non-dict element aborts the whole file listing.
Source
Thrown at python/robomp/src/proxy_client.py:710
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 ""),
state=str(data.get("state") or ""),
submitted_at=str(data.get("submitted_at") or ""),
)
def _pr_file_from(data: Any) -> PullRequestFileInfo:
if not isinstance(data, dict):
raise GitHubError(500, "proxy returned malformed pr_file payload")
return PullRequestFileInfo(
path=str(data.get("path") or ""),
status=str(data.get("status") or ""),
additions=int(data.get("additions") or 0),
deletions=int(data.get("deletions") or 0),
patch=str(data.get("patch") or ""),
)
def _pr_from(data: Any) -> PullRequestInfo:
if not isinstance(data, dict):
raise GitHubError(500, "proxy returned malformed pr payload")
return PullRequestInfo(
repo=str(data["repo"]),
number=int(data["number"]),
html_url=str(data["html_url"]),
head_ref=str(data.get("head_ref") or ""),
base_ref=str(data.get("base_ref") or ""),View on GitHub (pinned to 9690622007)
Solutions
- Inspect the raw files response from the proxy and locate the non-object element.
- Invalidate proxy caches of the PR file listing that may use a legacy format.
- Upgrade/roll back the proxy so its file schema matches the client's.
- Retry the call; if persistent, fall back to fetching the diff via the git layer (compare head/base refs) instead of the proxy.
- Report the schema violation to the proxy maintainers.
Example fix
# before
files = client.list_pr_files("org/repo", pr) # GitHubError 500
# after
try:
files = client.list_pr_files("org/repo", pr)
except GitHubError as e:
if e.status == 500:
files = diff_via_git(head_ref, base_ref) # bypass proxy file listing
else:
raise Defensive patterns
Strategy: fallback
Validate before calling
raw = resp.json()
files = raw if isinstance(raw, list) else []
if any(not isinstance(f, dict) for f in files):
raise RuntimeError("proxy returned non-object pr_file entries") Type guard
def is_pr_file(data: object) -> bool:
return isinstance(data, dict) and "path" in data and "status" in data Try / catch
try:
files = client.list_pr_files("org/repo", pr)
except GitHubError as e:
if e.status == 500 and "malformed pr_file payload" in str(e):
files = diff_via_git(head_ref, base_ref) # bypass proxy file listing
else:
raise Prevention
- Keep a git-level diff fallback (compare head/base refs) for file listings.
- Check the proxy's handling of binary files — a common source of null entries.
- Invalidate proxy caches of file listings after proxy upgrades.
- Validate file-list responses in CI for large PRs where truncation/legacy formats appear.
When it happens
Trigger: Calling list_pr_files() when the proxy returns the files array containing nulls/scalars, or a non-object body entirely (e.g. a bare list of path strings).
Common situations: Proxy serving a legacy flat path-list format for large PRs; null entries for binary files if the proxy mishandles them; proxy cache holding an outdated schema; version skew between proxy and client.
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 review_comment payload
- proxy returned malformed pr_review 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/3b5a131c3901fe18.
Report an issue: GitHub.