{"record":{"id":"65f00dc21e64e3c7","repo":"FoundationAgents/MetaGPT","slug":"only-code-reviews-for-python-and-java-languages-ar","errorCode":null,"errorMessage":"Only code reviews for Python and Java languages are supported.","messagePattern":"Only code reviews for Python and Java languages are supported\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"metagpt/ext/cr/actions/code_review.py","lineNumber":205,"sourceCode":"                valid_patch_count += 1\n            else:\n                continue\n            group_points = [points[i : i + 3] for i in range(0, len(points), 3)]\n            for group_point in group_points:\n                points_str = \"id description\\n\"\n                points_str += \"\\n\".join([f\"{p.id} {p.text}\" for p in group_point])\n                prompt = CODE_REVIEW_PROMPT_TEMPLATE.format(patch=str(patched_file), points=points_str)\n                resp = await self.llm.aask(prompt)\n                json_str = parse_json_code_block(resp)[0]\n                comments_batch = json.loads(json_str)\n                if comments_batch:\n                    patched_file_path = patched_file.path\n                    for c in comments_batch:\n                        c[\"commented_file\"] = patched_file_path\n                    comments.extend(comments_batch)\n\n        if valid_patch_count == 0:\n            raise ValueError(\"Only code reviews for Python and Java languages are supported.\")\n\n        return comments\n\n    async def run(self, patch: PatchSet, points: list[Point], output_file: str):\n        patch: PatchSet = rm_patch_useless_part(patch)\n        patch: PatchSet = add_line_num_on_patch(patch)\n\n        result = []\n        async with EditorReporter(enable_llm_stream=True) as reporter:\n            log_cr_output_path = Path(output_file).with_suffix(\".log\")\n            await reporter.async_report(\n                {\"src_path\": str(log_cr_output_path), \"filename\": log_cr_output_path.name}, \"meta\"\n            )\n            comments = await self.cr_by_points(patch=patch, points=points)\n            log_cr_output_path.parent.mkdir(exist_ok=True, parents=True)\n            async with aiofiles.open(log_cr_output_path, \"w\", encoding=\"utf-8\") as f:\n                await f.write(json.dumps(comments, ensure_ascii=False, indent=2))\n            await reporter.async_report(log_cr_output_path)","sourceCodeStart":187,"sourceCodeEnd":223,"githubUrl":"https://github.com/FoundationAgents/MetaGPT/blob/11cdf466d042aece04fc6cfd13b28e1a70341b1f/metagpt/ext/cr/actions/code_review.py#L187-L223","documentation":"Raised by the code-review action when valid_patch_count == 0 after iterating the patch set — i.e. no patched file in the patch was recognized as reviewable. The reviewer only reviews patches it can parse and map to supported languages (Python/Java), so an all-filtered patch set yields zero reviews and this error signals that nothing was reviewable.","triggerScenarios":"Calling run(patch, points, output_file) with a PatchSet whose files are all non-Python/Java (or whose hunks rm_patch_useless_part/add_line_num_on_patch stripped out), so every file is skipped and valid_patch_count stays 0.","commonSituations":"Running the CR tool on a PR that only touches JS/Go/Rust/docs; feeding a patch for a repo whose diff context lines confuse the parser; passing an empty patch.","solutions":["Confirm the patch actually contains Python or Java file diffs and is a valid unified diff","If reviewing other languages is intended, this action does not support them — skip the tool for such PRs instead of erroring","Inspect the patch after rm_patch_useless_part to see whether all hunks were stripped as useless parts"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"reviewable = [f for f in patch if str(f.path).endswith((\".py\", \".java\"))]\nif not reviewable:\n    skip review instead of calling run()","typeGuard":"def patch_has_reviewable_files(patch) -> bool:\n    return any(str(f.path).endswith((\".py\", \".java\")) for f in patch)","tryCatchPattern":"try:\n    comments = await action.run(patch, points, output_file)\nexcept ValueError as e:\n    if \"Only code reviews\" in str(e):\n        comments = []  # nothing reviewable in this patch\n    else:\n        raise","preventionTips":["Pre-filter patches to Python/Java files before invoking the reviewer","Do not run the CR action on doc-only or unsupported-language PRs"],"tags":["code-review","patch","language-support"],"backgroundTag":null,"analyzedSha":"11cdf466d042aece04fc6cfd13b28e1a70341b1f","analyzedAt":"2026-08-14T23:20:02.994Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}