{"record":{"id":"1943313e86860ad7","repo":"NationalSecurityAgency/ghidra","slug":"cannot-write-value-schema-value-type-value","errorCode":null,"errorMessage":"Cannot write Value: {schema}, {value}, {type(value)}","messagePattern":"Cannot write Value: (.+?), (.+?), (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"Ghidra/Debug/Debugger-rmi-trace/src/main/py/src/ghidratrace/client.py","lineNumber":854,"sourceCode":"    @staticmethod\n    def _try_write_array(to: bufs.Value, value: Iterable,\n                         schema: Optional[sch.Schema]) -> None:\n        if schema == sch.BOOL_ARR:\n            to.bool_arr_value.arr[:] = value\n            return\n        elif schema == sch.SHORT_ARR:\n            to.short_arr_value.arr[:] = value\n            return\n        elif schema == sch.INT_ARR:\n            to.int_arr_value.arr[:] = value\n            return\n        elif schema == sch.LONG_ARR:\n            to.long_arr_value.arr[:] = value\n            return\n        elif schema == sch.STRING_ARR:\n            to.string_arr_value.arr[:] = value\n            return\n        raise ValueError(\n            f\"Cannot write Value: {schema}, {value}, {type(value)}\")\n\n    @staticmethod\n    def _write_parameter(to: bufs.MethodParameter, p: RemoteParameter) -> None:\n        to.name = p.name\n        to.type.name = p.schema.name\n        to.required = p.required\n        Client._write_value(to.default_value, p.default)\n        to.display = p.display\n        to.description = p.description\n\n    @staticmethod\n    def _write_parameters(to: RCFC[bufs.MethodParameter],\n                          parameters: Iterable[RemoteParameter]) -> None:\n        for i, p in enumerate(parameters):\n            to.add()\n            Client._write_parameter(to[i], p)\n","sourceCodeStart":836,"sourceCodeEnd":872,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Debug/Debugger-rmi-trace/src/main/py/src/ghidratrace/client.py#L836-L872","documentation":"Raised by Client._write_value() when serializing a Value and the given schema matches none of the handled writer branches (bool/byte/char/short/int/long/str/bytes/address/range/object and the *_ARR arrays). This means either the schema itself is unrecognized or the value does not match a branch the writer knows about — the pair cannot be placed on the wire.","triggerScenarios":"Passing a Schema with a custom/unknown name, passing a schema constant that was removed/renamed between versions, or a value whose schema is UNSPECIFIED/ANY (which have no writer).","commonSituations":"Version mismatch between client and server (new schema on one side, old writer on the other); constructing a Schema('CUSTOM') by hand; a method returning a value typed as ANY.","solutions":["Use only the sch.* constants defined in sch.py for wire values.","Ensure client and server share the same ghidratrace version.","Avoid ANY/UNSPECIFIED as a concrete value schema; pick the precise scalar/array/object schema."],"exampleFix":"# before\nto_value(value, sch.Schema('WIDGET'))\n# after\nfrom ghidratrace import sch\nto_value(value, sch.STRING)  # use a supported schema constant","handlingStrategy":"type-guard","validationCode":"import ghidratrace.sch as sch\nWRITABLE = {sch.BOOL, sch.BYTE, sch.CHAR, sch.SHORT, sch.INT, sch.LONG,\n            sch.STRING, sch.BYTE_ARR, sch.ADDRESS, sch.RANGE, sch.OBJECT,\n            sch.BOOL_ARR, sch.CHAR_ARR, sch.SHORT_ARR, sch.INT_ARR,\n            sch.LONG_ARR, sch.STRING_ARR}\nif schema not in WRITABLE:\n    raise TypeError(f'Unwritable schema {schema}')","typeGuard":"def is_writable_schema(s) -> bool:\n    import ghidratrace.sch as sch\n    return s in {sch.BOOL, sch.BYTE, sch.CHAR, sch.SHORT, sch.INT, sch.LONG,\n                 sch.STRING, sch.BYTE_ARR, sch.ADDRESS, sch.RANGE, sch.OBJECT,\n                 sch.BOOL_ARR, sch.CHAR_ARR, sch.SHORT_ARR, sch.INT_ARR,\n                 sch.LONG_ARR, sch.STRING_ARR}","tryCatchPattern":null,"preventionTips":["Only use the sch.* constants for wire values.","Avoid ANY/UNSPECIFIED as concrete value schemas."],"tags":["internal","trace-rmi","serialization","schema"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}