NationalSecurityAgency/ghidra · error · ValueError
Cannot write Value: {schema}, {value}, {type(value)}
Error message
Cannot write Value: {schema}, {value}, {type(value)} What it means
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.
Source
Thrown at Ghidra/Debug/Debugger-rmi-trace/src/main/py/src/ghidratrace/client.py:854
@staticmethod
def _try_write_array(to: bufs.Value, value: Iterable,
schema: Optional[sch.Schema]) -> None:
if schema == sch.BOOL_ARR:
to.bool_arr_value.arr[:] = value
return
elif schema == sch.SHORT_ARR:
to.short_arr_value.arr[:] = value
return
elif schema == sch.INT_ARR:
to.int_arr_value.arr[:] = value
return
elif schema == sch.LONG_ARR:
to.long_arr_value.arr[:] = value
return
elif schema == sch.STRING_ARR:
to.string_arr_value.arr[:] = value
return
raise ValueError(
f"Cannot write Value: {schema}, {value}, {type(value)}")
@staticmethod
def _write_parameter(to: bufs.MethodParameter, p: RemoteParameter) -> None:
to.name = p.name
to.type.name = p.schema.name
to.required = p.required
Client._write_value(to.default_value, p.default)
to.display = p.display
to.description = p.description
@staticmethod
def _write_parameters(to: RCFC[bufs.MethodParameter],
parameters: Iterable[RemoteParameter]) -> None:
for i, p in enumerate(parameters):
to.add()
Client._write_parameter(to[i], p)
View on GitHub (pinned to d5f144c24d)
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.
Example fix
# before
to_value(value, sch.Schema('WIDGET'))
# after
from ghidratrace import sch
to_value(value, sch.STRING) # use a supported schema constant Defensive patterns
Strategy: type-guard
Validate before calling
import ghidratrace.sch as sch
WRITABLE = {sch.BOOL, sch.BYTE, sch.CHAR, sch.SHORT, sch.INT, sch.LONG,
sch.STRING, sch.BYTE_ARR, sch.ADDRESS, sch.RANGE, sch.OBJECT,
sch.BOOL_ARR, sch.CHAR_ARR, sch.SHORT_ARR, sch.INT_ARR,
sch.LONG_ARR, sch.STRING_ARR}
if schema not in WRITABLE:
raise TypeError(f'Unwritable schema {schema}') Type guard
def is_writable_schema(s) -> bool:
import ghidratrace.sch as sch
return s in {sch.BOOL, sch.BYTE, sch.CHAR, sch.SHORT, sch.INT, sch.LONG,
sch.STRING, sch.BYTE_ARR, sch.ADDRESS, sch.RANGE, sch.OBJECT,
sch.BOOL_ARR, sch.CHAR_ARR, sch.SHORT_ARR, sch.INT_ARR,
sch.LONG_ARR, sch.STRING_ARR} Prevention
- Only use the sch.* constants for wire values.
- Avoid ANY/UNSPECIFIED as concrete value schemas.
When it happens
Trigger: 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).
Common situations: 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.
Related errors
- Cannot convert: {value:r}
- Object/proxy has neither id nor path!: {}
- The parameter '%s' of method '%s' refers to a non-existent s
- Cannot get schema for {annotation}
- Could not read value: {}
AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14).
Data as JSON: /api/errors/1943313e86860ad7.
Report an issue: GitHub.