{"record":{"id":"0a84c19dda0f6e3a","repo":"can1357/oh-my-pi","slug":"proxy-returned-malformed-review-comment-payload","errorCode":null,"errorMessage":"proxy returned malformed review_comment payload","messagePattern":"proxy returned malformed review_comment payload","errorType":"exception","errorClass":"GitHubError","httpStatus":500,"severity":"error","filePath":"python/robomp/src/proxy_client.py","lineNumber":684,"sourceCode":"        author=str(data.get(\"author\") or \"\"),\n        body=str(data.get(\"body\") or \"\"),\n        created_at=str(data.get(\"created_at\") or \"\"),\n    )\n\n\ndef _reaction_from(data: Any) -> ReactionInfo:\n    if not isinstance(data, dict):\n        raise GitHubError(500, \"proxy returned malformed reaction payload\")\n    return ReactionInfo(\n        content=str(data.get(\"content\") or \"\"),\n        user_login=str(data.get(\"user_login\") or \"\"),\n        user_type=str(data.get(\"user_type\") or \"\"),\n    )\n\n\ndef _review_comment_from(data: Any) -> ReviewCommentInfo:\n    if not isinstance(data, dict):\n        raise GitHubError(500, \"proxy returned malformed review_comment payload\")\n    line = data.get(\"line\")\n    return ReviewCommentInfo(\n        id=int(data.get(\"id\") or 0),\n        author=str(data.get(\"author\") or \"\"),\n        body=str(data.get(\"body\") or \"\"),\n        path=str(data.get(\"path\") or \"\"),\n        line=line if isinstance(line, int) else None,\n        created_at=str(data.get(\"created_at\") or \"\"),\n    )\n\n\ndef _pr_review_from(data: Any) -> PullRequestReviewInfo:\n    if not isinstance(data, dict):\n        raise GitHubError(500, \"proxy returned malformed pr_review payload\")\n    return PullRequestReviewInfo(\n        id=int(data.get(\"id\") or 0),\n        author=str(data.get(\"author\") or \"\"),\n        body=str(data.get(\"body\") or \"\"),","sourceCodeStart":666,"sourceCodeEnd":702,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/python/robomp/src/proxy_client.py#L666-L702","documentation":"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.","triggerScenarios":"Calling list_review_comments() when the proxy returns a reviews/comments array containing null, strings, or other scalars instead of review-comment objects.","commonSituations":"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.","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."],"exampleFix":"# before\ncomments = client.list_review_comments(\"org/repo\", pr_number)  # GitHubError 500\n\n# after\ntry:\n    comments = client.list_review_comments(\"org/repo\", pr_number)\nexcept GitHubError as e:\n    if e.status == 500:\n        comments = []  # proceed without inline review comments\n    else:\n        raise","handlingStrategy":"try-catch","validationCode":"raw = resp.json()\nitems = raw if isinstance(raw, list) else []\nif any(not isinstance(x, dict) for x in items):\n    raise RuntimeError(\"proxy returned non-object review-comment entries\")","typeGuard":"def is_review_comment(data: object) -> bool:\n    return isinstance(data, dict) and \"id\" in data and \"path\" in data","tryCatchPattern":"try:\n    comments = client.list_review_comments(\"org/repo\", pr)\nexcept GitHubError as e:\n    if e.status == 500 and \"malformed review_comment payload\" in str(e):\n        comments = []  # proceed without inline comments\n    else:\n        raise","preventionTips":["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."],"tags":["proxy","payload-validation","pull-request","github"],"backgroundTag":"proxy-malformed-payload","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}