CherryHQ/cherry-studio · error · ValueError

Expected JSON object with 'reviews' key

Error message

Expected JSON object with 'reviews' key

What it means

Error "Expected JSON object with 'reviews' key" thrown in CherryHQ/cherry-studio.

Source

Thrown at resources/skills/skill-creator/eval-viewer/generate_review.py:369

            data = b"{}"
            if self.feedback_path.exists():
                data = self.feedback_path.read_bytes()
            self.send_response(200)
            self.send_header("Content-Type", "application/json")
            self.send_header("Content-Length", str(len(data)))
            self.end_headers()
            self.wfile.write(data)
        else:
            self.send_error(404)

    def do_POST(self) -> None:
        if self.path == "/api/feedback":
            length = int(self.headers.get("Content-Length", 0))
            body = self.rfile.read(length)
            try:
                data = json.loads(body)
                if not isinstance(data, dict) or "reviews" not in data:
                    raise ValueError("Expected JSON object with 'reviews' key")
                self.feedback_path.write_text(json.dumps(data, indent=2) + "\n")
                resp = b'{"ok":true}'
                self.send_response(200)
            except (json.JSONDecodeError, OSError, ValueError) as e:
                resp = json.dumps({"error": str(e)}).encode()
                self.send_response(500)
            self.send_header("Content-Type", "application/json")
            self.send_header("Content-Length", str(len(resp)))
            self.end_headers()
            self.wfile.write(resp)
        else:
            self.send_error(404)

    def log_message(self, format: str, *args: object) -> None:
        # Suppress request logging to keep terminal clean
        pass

View on GitHub (pinned to 726446b54c)

Solutions

  1. Ensure the input file passed to the script is a JSON object containing a top-level 'reviews' key.
  2. Regenerate the eval output with the expected schema, or convert the existing file to the required format.

Example fix

Run: python generate_review.py eval_output.json where eval_output.json is shaped as {"reviews": [...]}.

When it happens

Trigger: The eval-viewer HTTP server receives a POST /api/feedback whose body is valid JSON but is not an object containing a 'reviews' key.

Common situations: 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.


AI-assisted analysis of CherryHQ/cherry-studio@726446b54c (2026-08-12). Data as JSON: /api/errors/f766fb4836a91aab. Report an issue: GitHub.