NationalSecurityAgency/ghidra · error · KeyError

Invalid method name: {name}

Error message

Invalid method name: {name}

What it means

Raised as KeyError by Client._handle_invoke_method() when the requested method name is not present in the server's method registry. The server only knows methods that were registered and advertised during negotiation, so an unknown name means the client asked for something this server version does not provide.

Source

Thrown at Ghidra/Debug/Debugger-rmi-trace/src/main/py/src/ghidratrace/client.py:1358

        root.request_negotiate.version = VERSION
        root.request_negotiate.description = description
        self._write_methods(root.request_negotiate.methods,
                            self._method_registry._methods.values())

        def _handle(reply: bufs.ReplyNegotiate) -> str:
            return reply.description
        return self._now(root, 'reply_negotiate', _handle)

    def _handle_invoke_method(self, request: bufs.XRequestInvokeMethod) -> Any:
        if request.HasField('oid'):
            if request.oid.id not in self._traces:
                raise KeyError(f"Invalid domain object id: {request.oid.id}")
            trace = self._traces[request.oid.id]
        else:
            trace = None
        name = request.name
        if not name in self._method_registry._methods:
            raise KeyError(f"Invalid method name: {name}")
        method = self._method_registry._methods[name]
        kwargs = self._read_arguments(request.arguments, trace)
        return method.callback(**kwargs)


class Receiver(Thread):
    __slots__ = ('client', 'req_queue', '_is_shutdown')

    def __init__(self, client: Client) -> None:
        super().__init__(daemon=True)
        self.client: Client = client
        self.req_queue: deque[RemoteResult[Any, Any]] = deque()
        self.qlock: Lock = Lock()
        self._is_shutdown: bool = False

    def shutdown(self) -> None:
        self._is_shutdown = True

View on GitHub (pinned to d5f144c24d)

Solutions

  1. Align client and server to the same ghidratrace/Ghidra version so the negotiated method set matches.
  2. Check the method list returned by negotiate before calling, and degrade gracefully if absent.
  3. Verify spelling and that the owning plugin/module is loaded on the server.

Example fix

# before
client.invoke('mem_search', ...)
# after
methods = {m.name for m in client.negotiated_methods}
if 'mem_search' not in methods:
    raise RuntimeError('server does not support mem_search; upgrade Ghidra')
Defensive patterns

Strategy: validation

Validate before calling

known = {m.name for m in negotiated_methods}
if name not in known:
    raise KeyError(f'Method {name!r} not supported by server; known: {sorted(known)}')

Try / catch

try:
    client.invoke(name, ...)
except KeyError:
    # method unavailable; upgrade server or fall back

Prevention

When it happens

Trigger: Client calls a method added in a newer ghidratrace than the server runs; method name typo; client/server built from different module sets; calling a method before its plugin loaded it into the registry.

Common situations: Version skew between client and server; a debugger front-end assuming a method that the deployed Ghidra build does not register.

Related errors


AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14). Data as JSON: /api/errors/892adeded3891961. Report an issue: GitHub.