can1357/oh-my-pi · error · GitHubError

proxy returned malformed issue payload

Error message

proxy returned malformed issue payload

What it means

GitHubError(500) raised by _issue_from when the proxy response for a single issue is not a JSON object (dict). The library expects every issue payload from the GitHub proxy to be a mapping with required keys (repo, number); any non-dict (string, list, null) means the proxy protocol was violated. This is a server-side contract failure surfaced defensively to the client.

Source

Thrown at python/robomp/src/proxy_client.py:607

        html_url=str(data.get("html_url") or ""),
        asset_names=tuple(str(asset) for asset in data.get("asset_names") or []),
    )


def _repo_from(data: Any) -> RepoInfo:
    if not isinstance(data, dict):
        raise GitHubError(500, "proxy returned malformed repo payload")
    return RepoInfo(
        full_name=str(data["full_name"]),
        default_branch=str(data["default_branch"]),
        clone_url=str(data["clone_url"]),
        private=bool(data.get("private", False)),
    )


def _issue_from(data: Any) -> IssueInfo:
    if not isinstance(data, dict):
        raise GitHubError(500, "proxy returned malformed issue payload")
    labels = data.get("labels") or []
    return IssueInfo(
        repo=str(data["repo"]),
        number=int(data["number"]),
        title=str(data.get("title") or ""),
        body=str(data.get("body") or ""),
        state=str(data.get("state") or "open"),
        author=str(data.get("author") or ""),
        labels=tuple(str(x) for x in labels),
        is_pull_request=bool(data.get("is_pull_request", False)),
    )


def _issue_summary_from(data: Any) -> IssueSummary:
    if not isinstance(data, dict):
        raise GitHubError(500, "proxy returned malformed issue summary payload")
    return IssueSummary(
        repo=str(data["repo"]),

View on GitHub (pinned to 9690622007)

Solutions

  1. Inspect the raw proxy response for the issue endpoint (curl the proxy URL) to see what non-dict body is actually returned.
  2. Verify the proxy service version matches what this client expects and redeploy/restart it if it is stale or crashed.
  3. Check proxy logs for the failing request — an upstream GitHub error is probably being passed through in the wrong shape.
  4. Retry the request; if transient, add retry with backoff around get_issue().
  5. If the proxy is third-party, report the malformed-payload contract violation with the response body.

Example fix

# before
issue = client.get_issue("org/repo", 42)  # crashes with GitHubError 500

# after
try:
    issue = client.get_issue("org/repo", 42)
except GitHubError as e:
    if e.status == 500:
        raw = fetch_raw_issue("org/repo", 42)  # inspect/log actual proxy body
        raise RuntimeError(f"proxy payload malformed: {raw!r}") from e
    raise
Defensive patterns

Strategy: try-catch

Validate before calling

import json, requests
resp = requests.get(f"{PROXY_URL}/repos/org/repo/issues/42")
body = resp.json()
if not isinstance(body, dict):
    raise RuntimeError(f"proxy issue payload not an object: {body!r}")

Type guard

def is_issue_payload(data: object) -> bool:
    return isinstance(data, dict) and "repo" in data and "number" in data

Try / catch

from robomp.proxy_client import GitHubError
try:
    issue = client.get_issue("org/repo", 42)
except GitHubError as e:
    if e.status == 500 and "malformed issue payload" in str(e):
        issue = None  # or refetch raw / alert on proxy health
    else:
        raise

Prevention

When it happens

Trigger: Calling get_issue() when the proxy returns a non-object JSON body for the issue endpoint — e.g. a JSON array, a bare string, null, or an HTML/error page that was misparsed as JSON.

Common situations: Proxy deployed at a mismatched version returning an older/newer envelope; proxy error handler returning a JSON string or null instead of an object; misrouted endpoint returning a list; intermediary (gateway/LB) replacing the body with a plain-text or HTML error that got parsed as a scalar.

Understand the failure class

Related errors


AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31). Data as JSON: /api/errors/8d7c3bb7f356e941. Report an issue: GitHub.