Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Silens1 opened this issue Aug 23, 2017 · 9 comments
Open

Comments

@Silens1
Copy link

Silens1 commented Aug 23, 2017

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
Copy link
Member

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
Copy link

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

@Rabbit994
Copy link

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
Copy link
Member

Yepoleb commented Jan 5, 2018

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
Copy link

turbiv commented Mar 22, 2019

Getting same issue ...

@NotTrying
Copy link

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
Copy link
Member

Yepoleb commented Jan 17, 2020

Support for retries has been added to python-a2s

@arduinka55055
Copy link

Support for retries has been added to python-a2s

THANK YOU, you saved all my project

@qpyparty
Copy link

qpyparty commented Apr 3, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

10 participants