b1b78a06a3
The real root cause of the 'Cannot read properties of null (reading code)' error was hiding in two places, not one. The first (ConnectionResponse status) was fixed in the previous commit. This commit fixes the second: The KRPC.Type message has a 'code' field of nested-enum type 'Type.TypeCode'. When protobufjs decodes a GetServices response (which contains MANY Type messages inside Procedure.returnType fields), it hits the same nested-enum default-value lookup bug and throws the TypeError. The fix is identical to the ConnectionResponse.status fix: change the field type from the nested-enum reference to plain 'uint32'. The wire format is the same (varint), and our code in services.ts reads raw integers from the typecode field anyway. This error was happening OUTSIDE my top-level try/catch in client.connect() — it was in loadServices, called from adapter.connect(). The bridge's catch caught it, but the error message was the raw 'Cannot read properties of null (reading code)' because loadServices didn't wrap the error. Now: - The schema fix makes the decode actually succeed - The adapter wraps any remaining loadServices errors with a clear 'kRPC loadServices (GetServices decode) failed:' prefix so the next failure mode is immediately actionable