{"record":{"id":"8b9a7623d552333d","repo":"NationalSecurityAgency/ghidra","slug":"cannot-get-schema-for-annotation","errorCode":null,"errorMessage":"Cannot get schema for {annotation}","messagePattern":"Cannot get schema for (.+?)","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"Ghidra/Debug/Debugger-rmi-trace/src/main/py/src/ghidratrace/client.py","lineNumber":645,"sourceCode":"        elif t is Any:\n            return sch.ANY\n        elif t is bool:\n            return sch.BOOL\n        elif t is int:\n            return sch.LONG\n        elif t is str:\n            return sch.STRING\n        elif t is bytes:\n            return sch.BYTE_ARR\n        elif t is Address:\n            return sch.ADDRESS\n        elif t is AddressRange:\n            return sch.RANGE\n        elif t is TraceObject:\n            return sch.OBJECT\n        elif isinstance(t, type) and issubclass(t, TraceObject):\n            return sch.Schema(t.__name__)\n        raise TypeError(f\"Cannot get schema for {annotation}\")\n\n    @classmethod\n    def _to_display(cls, annotation: Any) -> str:\n        _, desc = find_metadata(annotation, ParamDesc)\n        if desc is not None:\n            return desc.display\n        return ''\n\n    @classmethod\n    def _to_description(cls, annotation: Any) -> str:\n        _, desc = find_metadata(annotation, ParamDesc)\n        if desc is not None:\n            return desc.description\n        return ''\n\n    @classmethod\n    def _make_param(cls, s: inspect.Signature, p: inspect.Parameter) -> RemoteParameter:\n        schema = cls._to_schema(s, p.annotation)","sourceCodeStart":627,"sourceCodeEnd":663,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Debug/Debugger-rmi-trace/src/main/py/src/ghidratrace/client.py#L627-L663","documentation":"Raised as TypeError when _to_schema() (in the method-registration/type-mapping code) cannot map a parameter or return annotation to one of the supported wire schemas: bool/byte/char/short/int/long/str/bytes/Address/AddressRange/TraceObject (and TraceObject subclasses). Any other annotation type falls through to this error, meaning the method cannot be serialized over TraceRMI.","triggerScenarios":"Annotating a registered method param/return with an unsupported type such as float, dict, list, a custom dataclass, or a typing construct like Any. The error fires at schema resolution time during method registration/negotiation.","commonSituations":"Adding a new method using a domain dataclass or a plain Python type not in the supported set; assuming generics are mapped automatically.","solutions":["Use only the supported scalar/object types for registered method signatures (see the elif chain in _to_schema).","For complex data, flatten to bytes/str (e.g. JSON) or pass via a TraceObject node.","For arrays, use the *_ARR schema types and the matching Python list annotations."],"exampleFix":"# before\n@method\ndef load(self, cfg: dict) -> None: ...\n# after\nimport json\n@method\ndef load(self, cfg_json: str) -> None:\n    cfg = json.loads(cfg_json)","handlingStrategy":"validation","validationCode":"SUPPORTED = {bool, bytearray, bytes, int, str, ...}  # mirror _to_schema\nif annotation not in SUPPORTED:\n    raise TypeError(f'Unsupported method type {annotation}')","typeGuard":"def is_supported_schema_type(t) -> bool:\n    import ghidratrace.sch as sch\n    from ghidratrace.client import Address, AddressRange, TraceObject\n    return t in (bool, bytes, str, int) or t in (Address, AddressRange, TraceObject) or (isinstance(t, type) and issubclass(t, TraceObject))","tryCatchPattern":null,"preventionTips":["Restrict registered method signatures to the supported scalar/object types.","Flatten complex types to str/bytes."],"tags":["type-system","trace-rmi","method-registration","schema"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}