{"id":21715,"library":"protobuf_decoder","title":"protobuf-decoder","description":"A Python library to decode Protocol Buffers (protobuf) without requiring the original .proto file. It can parse raw binary data and output a human-readable structure. Current version: 0.4.0, released June 2023. Development appears low-activity but stable, with several releases since 2022.","status":"active","version":"0.4.0","language":"python","source_language":"en","source_url":"https://github.com/dannyhann/protobuf_decoder","tags":["protobuf","protocol-buffers","decoder","reverse-engineering","binary-parsing"],"install":[{"cmd":"pip install protobuf-decoder","lang":"bash","label":"PyPI"}],"dependencies":[{"reason":"Uses Google's protobuf library internally for wire types and encoding","package":"protobuf","optional":false}],"imports":[{"note":"Common mistake: trying to import from a submodule that doesn't exist","wrong":"from protobuf_decoder.protobuf import ProtobufDecoder","symbol":"ProtobufDecoder","correct":"from protobuf_decoder import ProtobufDecoder"},{"note":"The function is named `parse`, not `decode`","wrong":"from protobuf_decoder import decode","symbol":"parse","correct":"from protobuf_decoder import parse"}],"quickstart":{"code":"from protobuf_decoder import ProtobufDecoder\n\n# Example: decode a raw protobuf message\nraw_protobuf = b'\\x08\\x96\\x01'  # field 1, varint value 150\n\ndecoder = ProtobufDecoder(raw_protobuf)\ndecoded = decoder.decode()\nprint(decoded)  # [{'field_number': 1, 'field_name': '1', 'field_type': 'VarintValue', 'value': 150}]\n\n# Or use the parse function directly\nfrom protobuf_decoder import parse\ndecoded = parse(raw_protobuf)\nprint(decoded)  # same result","lang":"python","description":"Basic usage: decode a raw protobuf message to a list of decoded fields."},"warnings":[{"fix":"Use official protobuf compiler or schema-based tools for field name resolution.","message":"The library does not reconstruct .proto schema or generate human-readable field names. It only outputs field numbers and unknown field types. If you need field names, you must supply a .proto file (this lib doesn't support it).","severity":"gotcha","affected_versions":"all"},{"fix":"Always call .decode() on the decoder instance, or use the convenience `parse()` function.","message":"When using the ProtobufDecoder class, you must call .decode() to get the parsed fields. The constructor itself does not parse immediately.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Check the output carefully; consider using `strict_mode` parameter if available to control nested parsing.","message":"The `to_dict()` method (added in v0.4.0) may return a flat dictionary with field numbers as string keys. It does not handle nested message structures perfectly; nested data may be represented as bytes or as sub-dictionaries depending on detection.","severity":"gotcha","affected_versions":">=0.4.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Run `pip install protobuf-decoder`. Note the hyphen in pip install, but the import uses underscore.","cause":"The library is not installed or the install name is wrong.","error":"ImportError: cannot import name 'ProtobufDecoder' from 'protobuf_decoder' (unknown location)"},{"fix":"Ensure the input is a bytes-like object. Validate that the data is not None before passing.","cause":"Passing `None` as the raw protobuf data to the decoder.","error":"TypeError: object of type 'NoneType' has no len()"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}