{"record":{"id":"2b723a29b659f0a8","repo":"canopy-network/canopy","slug":"query-response-error-msg","errorCode":null,"errorMessage":"{query_response.error.msg}","messagePattern":"\\{query_response\\.error\\.msg\\}","errorType":"exception","errorClass":"PluginError","httpStatus":null,"severity":"error","filePath":"plugin/python/contract/plugin.py","lineNumber":289,"sourceCode":"        message = PluginToFSM()\n        message.id = request_id\n        message.query.height = height\n        message.query.read.CopyFrom(request)\n\n        try:\n            logger.debug(f\"0x{request_id:x}: query_state (height={height})\")\n            await self._send_proto_msg(message)\n\n            # wait for response with timeout\n            response = await asyncio.wait_for(future, timeout=10.0)\n\n            if not response.HasField(\"query\"):\n                raise err_unexpected_fsm_to_plugin(type(response))\n\n            query_response = response.query\n            # surface any FSM-side error attached to the query response\n            if query_response.HasField(\"error\"):\n                raise PluginError(\n                    query_response.error.code,\n                    query_response.error.module,\n                    query_response.error.msg,\n                )\n            # return the unwrapped read response\n            return query_response.read\n\n        except asyncio.TimeoutError:\n            raise err_plugin_timeout()\n        finally:\n            self._pending.pop(request_id, None)\n\n    async def _listen_for_inbound(self) -> None:\n        \"\"\"ListenForInbound routes inbound requests from the plugin.\"\"\"\n        if not self._reader:\n            raise PluginError(1, \"plugin\", \"No reader available\")\n\n        try:","sourceCodeStart":271,"sourceCodeEnd":307,"githubUrl":"https://github.com/canopy-network/canopy/blob/ee8197d91dd410f6592cb650a94c925ee6dc8bad/plugin/python/contract/plugin.py#L271-L307","documentation":"Raised in query_state when the FSM's query response carries an error field; the FSM-side error message is re-raised locally. It means the state query at the requested height failed on the FSM (e.g. state not found, height not available, or internal FSM error), not that the transport failed.","triggerScenarios":"Thrown at plugin/python/contract/plugin.py:289 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Read the embedded error message to determine the FSM-side cause and fix the query (height, key range) accordingly.","Retry the query if the error indicates a transient condition (e.g. node catching up to the requested height).","Verify the queried state actually exists for the contract before issuing the query."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"ee8197d91dd410f6592cb650a94c925ee6dc8bad","analyzedAt":"2026-09-06T09:30:15.973Z","contentChangedAt":"2026-09-06T09:30:15.973Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}