{"record":{"id":"f766fb4836a91aab","repo":"CherryHQ/cherry-studio","slug":"expected-json-object-with-reviews-key","errorCode":null,"errorMessage":"Expected JSON object with 'reviews' key","messagePattern":"Expected JSON object with 'reviews' key","errorType":"http","errorClass":"ValueError","httpStatus":500,"severity":"error","filePath":"resources/skills/skill-creator/eval-viewer/generate_review.py","lineNumber":369,"sourceCode":"            data = b\"{}\"\n            if self.feedback_path.exists():\n                data = self.feedback_path.read_bytes()\n            self.send_response(200)\n            self.send_header(\"Content-Type\", \"application/json\")\n            self.send_header(\"Content-Length\", str(len(data)))\n            self.end_headers()\n            self.wfile.write(data)\n        else:\n            self.send_error(404)\n\n    def do_POST(self) -> None:\n        if self.path == \"/api/feedback\":\n            length = int(self.headers.get(\"Content-Length\", 0))\n            body = self.rfile.read(length)\n            try:\n                data = json.loads(body)\n                if not isinstance(data, dict) or \"reviews\" not in data:\n                    raise ValueError(\"Expected JSON object with 'reviews' key\")\n                self.feedback_path.write_text(json.dumps(data, indent=2) + \"\\n\")\n                resp = b'{\"ok\":true}'\n                self.send_response(200)\n            except (json.JSONDecodeError, OSError, ValueError) as e:\n                resp = json.dumps({\"error\": str(e)}).encode()\n                self.send_response(500)\n            self.send_header(\"Content-Type\", \"application/json\")\n            self.send_header(\"Content-Length\", str(len(resp)))\n            self.end_headers()\n            self.wfile.write(resp)\n        else:\n            self.send_error(404)\n\n    def log_message(self, format: str, *args: object) -> None:\n        # Suppress request logging to keep terminal clean\n        pass\n\n","sourceCodeStart":351,"sourceCodeEnd":387,"githubUrl":"https://github.com/CherryHQ/cherry-studio/blob/726446b54cd69ffe51a276638672f6d95ca0768c/resources/skills/skill-creator/eval-viewer/generate_review.py#L351-L387","documentation":"Error \"Expected JSON object with 'reviews' key\" thrown in CherryHQ/cherry-studio.","triggerScenarios":"The eval-viewer HTTP server receives a POST /api/feedback whose body is valid JSON but is not an object containing a 'reviews' key.","commonSituations":"Happens when a client posts malformed feedback to the review viewer — wrong payload shape or a stale caller. The server responds with HTTP 500 and the error message in a JSON error body.","solutions":["Ensure the input file passed to the script is a JSON object containing a top-level 'reviews' key.","Regenerate the eval output with the expected schema, or convert the existing file to the required format."],"exampleFix":"Run: python generate_review.py eval_output.json where eval_output.json is shaped as {\"reviews\": [...]}.","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"726446b54cd69ffe51a276638672f6d95ca0768c","analyzedAt":"2026-08-12T17:30:37.448Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}