serverstf / python-valve

A Python Interface to various Valve products and services
Other
235 stars 71 forks source link

messages.BrokenMessageError: Invalid value (65) for field 'response_type' #48

Open Silens1 opened 7 years ago

Silens1 commented 7 years ago

Anytime i try to get the rules for a server i receive this error, all the others (info, players, ping, etc) work fine, but rules always fails with the same error for all servers. Anyone have any clues?

Edit: So I don't know why but the game I'm using this with will sometimes reply with another challenge number after sending the previous received challenge number, instead of the rules. The challenge number sometimes is the same and sometimes it's a different one.
For now I've "fixed it" by modifying messages-RulesResponse.decode to check if the response is a challenge response (x41), process the packet through RulesRequest instead, and then in a2s -ServerQuerier - rules added a loop sending another RulesRequest with the new challenge number until the response is an actual rules response (x45) Probably not the right way to do it?

Holiverh commented 7 years ago

May I inquire as to what kind of server we are talking about here? TF2, CSGO, etc.. Also, is your workaround checked in anywhere so I could take a look at it? 👍

KillyMXI commented 7 years ago

I got this issue with server query example from https://github.com/serverstf/python-valve page.

Rabbit994 commented 6 years ago

I got the same exception when doing rules or player server query against Foxhole server (Unreal based game). Info works fine. When I modified messages.py to accept the 65 number number, I got following exception: type: valve.source.messages.BrokenMessageError Description: No string terminator

Server IP and Port in question is: 144.217.11.227:27015

Yepoleb commented 6 years ago

Adding a retry loop seems to indeed fix the problem and matches what the Steam client does. It's still not perfectly reliable, so whoever wrote the server code should definitely fix that. I also need to do some more testing before pushing this change.

turbiv commented 5 years ago

Getting same issue ...

NotTrying commented 5 years ago

I am getting this error also on 2 Rust servers. Have had a Rust server working fine previously, but these 2 keep giving the error.

139.99.144.99:28015 139.99.144.50:28009

import valve.source.a2s
SERVER_ADDRESS = ('139.99.144.50', 28009)
with valve.source.a2s.ServerQuerier(SERVER_ADDRESS, timeout=10) as server:
    info = server.info()
    players = server.players()
    print (info)
print("{player_count}/{max_players} {server_name}".format(**info))
for player in sorted(players["players"],
                     key=lambda p: p["score"], reverse=True):
    print("{score} {name}".format(**player)) 
..\lib\site-packages\valve\source\messages.py", line 91, in validate
    raise ValueError
ValueError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

 ..\lib\site-packages\valve\source\a2s.py", line 200, in players
    return messages.PlayersResponse.decode(self.get_response())
  ..\lib\site-packages\valve\source\messages.py", line 415, in decode
    values[field.name], buffer = field.decode(buffer, values)
  ..\lib\site-packages\valve\source\messages.py", line 41, in needs_buffer
    return func(self, buffer, *args, **kwargs)
  ..\lib\site-packages\valve\source\messages.py", line 131, in decode
    struct.unpack(self.format, field_data)[0]), left_overs)
  ..\lib\site-packages\valve\source\messages.py", line 95, in validate
    value, self.name))
valve.source.messages.BrokenMessageError: Invalid value (65) for field 'response_type'
Yepoleb commented 4 years ago

Support for retries has been added to python-a2s

arduinka55055 commented 3 years ago

Support for retries has been added to python-a2s

THANK YOU, you saved all my project

qpyparty commented 1 year ago

valve.source.messages.BrokenMessageError: Invalid value (109) for field 'response_type' how to fix this error?