{"record":{"id":"248f3332141fb14d","repo":"langgenius/dify","slug":"invalid-hit-testing-record-response","errorCode":null,"errorMessage":"Invalid hit testing record response","messagePattern":"Invalid hit testing record response","errorType":"validation","errorClass":"ValueError","httpStatus":400,"severity":"error","filePath":"api/controllers/console/datasets/hit_testing_base.py","lineNumber":59,"sourceCode":"        description=\"Retrieval settings for external knowledge bases.\",\n    )\n    attachment_ids: list[str] | None = Field(\n        default=None,\n        description=\"List of attachment IDs to include in the retrieval context.\",\n    )\n\n\nclass DatasetsHitTestingBase:\n    @staticmethod\n    def _prepare_hit_testing_records(records: Any) -> list[dict[str, Any]]:\n        \"\"\"Ensure collection fields match the API schema before response validation.\"\"\"\n        if not isinstance(records, list):\n            raise ValueError(\"Invalid hit testing records response\")\n\n        normalized_records: list[dict[str, Any]] = []\n        for record in records:\n            if not isinstance(record, dict):\n                raise ValueError(\"Invalid hit testing record response\")\n\n            normalized_record = dict(record)\n            segment = normalized_record.get(\"segment\")\n            if isinstance(segment, dict):\n                normalized_segment = dict(segment)\n                normalized_segment.setdefault(\"sign_content\", None)\n                if normalized_segment.get(\"keywords\") is None:\n                    normalized_segment[\"keywords\"] = []\n                normalized_record[\"segment\"] = normalized_segment\n\n            if normalized_record.get(\"child_chunks\") is None:\n                normalized_record[\"child_chunks\"] = []\n\n            if normalized_record.get(\"files\") is None:\n                normalized_record[\"files\"] = []\n\n            normalized_record.setdefault(\"tsne_position\", None)\n            normalized_record.setdefault(\"summary\", None)","sourceCodeStart":41,"sourceCodeEnd":77,"githubUrl":"https://github.com/langgenius/dify/blob/ef8544b173fd6cd7a8e71df2cab576e52bebbfbc/api/controllers/console/datasets/hit_testing_base.py#L41-L77","documentation":"Error \"Invalid hit testing record response\" thrown in langgenius/dify.","triggerScenarios":"Thrown at api/controllers/console/datasets/hit_testing_base.py:59 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"ef8544b173fd6cd7a8e71df2cab576e52bebbfbc","analyzedAt":"2026-08-12T05:15:17.394Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}