thingsboard / thingsboard/thingsboard

[BUG] MQTT Protobuf field names converted from snake_case to camelCase automatically

Open
#14,639 3 comments 1 reaction 3 assignees View on GitHub

@ViacheslavKlimov is already working on this.

Since Jan 5, 2026.

Backlog feature valid
Dominant language
Java
Stars
22.4k
Forks
6.5k
Avg merge
18h 26m
Merged PRs (30d)
37

Description

Problem Statement

Protocol Buffer messages sent via MQTT with snake_case field names are being automatically converted to lowerCamelCase when stored in ThingsBoard. This is a breaking change that affects backward compatibility with existing Protobuf-based IoT devices. Above all, it affects to firmware updates because key you can't choose the key that server sends.

Server Environment

Your Client Environment

  • Independent

Connectivity

  • MQTT with pb

Expected behavior
Protobuf field names should be preserved as defined in the .proto schema:

  • Field: current_fw_title → stored as current_fw_title
  • Field: fw_state → stored as fw_state
  • Field: target_fw_version → stored as target_fw_version

Actual behavior
Protobuf field names are converted to lowerCamelCase:

  • Field: current_fw_title → stored as currentFwTitle
  • Field: fw_state → stored as fwState
  • Field: target_fw_version → stored as targetFwVersion

Possible cause (My Analysis)
I believe this is caused by Protobuf 3.25.5 (introduced in ThingsBoard v4.2.0) where JsonFormat.printer() converts field names to lowerCamelCase by default:

Impact

  1. OTA Firmware Updates: Fields like current_fw_title, fw_state, target_fw_version documented in ThingsBoard OTA guide are not recognized
  2. Backward Compatibility: Breaking change for existing Protobuf-based devices
  3. Data Integrity: Duplicate attribute names (camelCase versions contain data, snake_case versions are empty)
  4. Silent Breaking Change: No migration path or documentation provided when v4.2.0 was released

Steps to reproduce

  1. Define a Protobuf message with snake_case field names:
    message FirmwareStatus { string current_fw_title = 1; string current_fw_version = 2; string fw_state = 3; string target_fw_title = 4; string target_fw_version = 5; }
  2. Send message via MQTT from IoT device
  3. Check device attributes or telemetry in ThingsBoard
  4. Expected: Attributes named current_fw_title, current_fw_version, etc.
  5. Actual: Attributes named currentFwTitle, currentFwVersion, etc.

Note

I'm reporting this based on the evidence of duplicate telemetry or atributtes (only camelCase versions have data), the version upgrade timeline coinciding with my observation , and the official Protobuf documentation about default camelCase conversion.

However, I'm not 100% certain about the exact implementation details or if there are other factors I'm missing. The main problem is clearly visible (snake_case fields being converted to camelCase), but I could be wrong about the root cause.

If I've misdiagnosed the issue, I apologize and would appreciate any clarification. I'm just trying to report what I'm observing to help improve ThingsBoard!

Thanks for reviewing this! 🙏

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.