can1357/oh-my-pi · error · GitHubError

proxy returned malformed reaction payload

Error message

proxy returned malformed reaction payload

What it means

GitHubError(500) raised by _reaction_from when a reaction payload from the proxy is not a JSON object. Each reaction must be a dict (content, user_login, user_type); non-dict entries abort the whole reaction listing.

Source

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

        updated_at=str(data.get("updated_at") or ""),
        html_url=str(data.get("html_url") or ""),
    )


def _comment_from(data: Any) -> CommentInfo:
    if not isinstance(data, dict):
        raise GitHubError(500, "proxy returned malformed comment payload")
    return CommentInfo(
        id=int(data["id"]),
        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 ""),

View on GitHub (pinned to 9690622007)

Solutions

  1. Inspect the raw reactions response from the proxy to find the non-object element.
  2. Refresh/invalidate proxy caches that may hold the legacy reaction format.
  3. Update the proxy to the client-compatible version and redeploy.
  4. Retry the call; if it persists, skip reaction data (treat as empty) with a logged warning.
  5. Report the schema violation to the proxy maintainers.

Example fix

# before
reactions = client.list_comment_reactions("org/repo", 42, comment_id)

# after
try:
    reactions = client.list_comment_reactions("org/repo", 42, comment_id)
except GitHubError as e:
    if e.status == 500:
        reactions = []  # degrade gracefully; reactions are non-critical
    else:
        raise
Defensive patterns

Strategy: fallback

Validate before calling

raw = resp.json()
if any(not isinstance(r, dict) for r in (raw if isinstance(raw, list) else [])):
    raise RuntimeError("non-object reaction entries in proxy response")

Type guard

def is_reaction_payload(data: object) -> bool:
    return isinstance(data, dict) and "content" in data

Try / catch

try:
    reactions = client.list_comment_reactions("org/repo", 42, cid)
except GitHubError as e:
    if e.status == 500 and "malformed reaction payload" in str(e):
        reactions = []  # reactions are non-critical
    else:
        raise

Prevention

When it happens

Trigger: Calling list_comment_reactions() when the proxy returns scalars or nulls inside the reactions array instead of reaction objects.

Common situations: Proxy serialization bug for reactions by ghost/deleted users (emitted as null); legacy flat-string reaction format from an old proxy cache; version skew between proxy and client schema.

Understand the failure class

Related errors


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