{"record":{"id":"1432da44d10670db","repo":"ZhuLinsen/daily_stock_analysis","slug":"invalid-field-name-json","errorCode":null,"errorMessage":"invalid {field_name} JSON","messagePattern":"invalid (.+?) JSON","errorType":"exception","errorClass":"ValueError","httpStatus":500,"severity":"error","filePath":"src/services/history_service.py","lineNumber":503,"sourceCode":"            ),\n            raw_result=self._parse_diagnostic_json_field(\n                getattr(record, \"raw_result\", None),\n                \"raw_result\",\n            ),\n        )\n\n    @staticmethod\n    def _parse_diagnostic_json_field(value: Any, field_name: str) -> Any:\n        \"\"\"Strict JSON parser for persisted diagnostic inputs.\"\"\"\n        if value is None:\n            return None\n        if isinstance(value, str):\n            if not value.strip():\n                return None\n            try:\n                return json.loads(value)\n            except (json.JSONDecodeError, TypeError, ValueError) as exc:\n                raise ValueError(f\"invalid {field_name} JSON\") from exc\n        return value\n\n    def get_history_detail_by_id(self, record_id: int) -> Optional[Dict[str, Any]]:\n        \"\"\"\n        Get history report detail.\n\n        Uses database primary key for precise query, avoiding returning incorrect records \n        due to duplicate query_id in batch analysis.\n\n        Args:\n            record_id: Analysis history record primary key ID\n\n        Returns:\n            Complete analysis report dictionary, or None if not exists\n        \"\"\"\n        try:\n            record = self.db.get_analysis_history_by_id(record_id)\n            if not record:","sourceCodeStart":485,"sourceCodeEnd":521,"githubUrl":"https://github.com/ZhuLinsen/daily_stock_analysis/blob/5159bd72e8373d215492dff122acc9d389e219c9/src/services/history_service.py#L485-L521","documentation":"Error \"invalid {field_name} JSON\" thrown in ZhuLinsen/daily_stock_analysis.","triggerScenarios":"Thrown at src/services/history_service.py:503 when the library encounters an invalid state.","commonSituations":"Raised when a JSON field stored on a history record cannot be parsed; occurs when legacy or corrupted rows contain malformed JSON in raw_result or related fields.","solutions":["Ensure the named field contains valid JSON text before saving or parsing.","Fix the stored record: re-save the field as serialized JSON rather than a Python repr or truncated string.","If the field should be optional, pass null/empty instead of malformed JSON."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"5159bd72e8373d215492dff122acc9d389e219c9","analyzedAt":"2026-08-15T01:59:36.292Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}