Skip to content

[Bug] Factory reset commands fail with protobuf 7.x: Expected an int, got a boolean #919

@andrewarabian

Description

@andrewarabian

Bug Report: Factory Reset CLI Commands Fail with protobuf 7.x

Package: meshtastic (Python CLI)
Version: 2.7.8
Date: 2026-04-25


Summary

Running meshtastic --factory-reset or meshtastic --factory-reset-device from the command line fails immediately with an error and does not reset the device. The commands appear to connect successfully but abort before sending anything to the radio.

The Problem

In node.py, the two fields are assigned Python boolean values:

File: meshtastic/node.py

# Line 731
p.factory_reset_device = True

# Line 734
p.factory_reset_config = True

In Python, True and 1 are nearly equivalent True == 1 evaluates to True, and in most contexts they are interchangeable. This worked fine with protobuf versions prior to 7.x because the library was permissive about type coercion.

protobuf 7.x introduced strict type enforcement. It now validates that the value assigned to a field matches the field's declared type exactly. Since factory_reset_device and factory_reset_config are declared as integers in the .proto schema, protobuf 7.x rejects a Python bool and raises a TypeError, which the CLI catches and surfaces as the "Aborting due to" message.


The Fix

Change True to 1 on both lines in node.py:

# Before
p.factory_reset_device = True
p.factory_reset_config = True

# After
p.factory_reset_device = 1
p.factory_reset_config = 1

Temporary Workaround

For users who need factory reset functionality before this is patched in a release, edit the installed source file directly:

~/.local/lib/python3.14/site-packages/meshtastic/node.py

Change lines 731 and 734 from True to 1 as shown above.


Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions