Skip to content

fix(mqtt): propagate JSON query evaluation errors - #7643

Open
larsch wants to merge 1 commit into
louislam:masterfrom
larsch:fix/mqtt-json-query-error
Open

fix(mqtt): propagate JSON query evaluation errors#7643
larsch wants to merge 1 commit into
louislam:masterfrom
larsch:fix/mqtt-json-query-error

Conversation

@larsch

@larsch larsch commented Jul 29, 2026

Copy link
Copy Markdown

Summary

  • Propagate MQTT JSONata evaluation errors instead of silently discarding them.

  • Report errors using the same format as HTTP(S) JSON-query monitors:

    Error evaluating JSON query: <error>. Response from server was: <message>
    
  • Prevent invalid expressions such as $toMillis("junk") from producing an empty value that numeric conditions interpret as 0.

  • Add a focused regression test covering an invalid $toMillis() expression with an MQTT json_value condition.

  • Preserve the existing HTTP(S) regression test confirming that invalid $toMillis() input is propagated.

  • Resolves MQTT JSON query conditions treat expression errors as zero #7642.

  • Full disclosure; AI was used to troubleshoot, debug, and implement this test and change, but I have reviewed and to my ability, the change and test are sound. The change is a one-liner, which brings the behavior into consistency with HTTP(s) endpoints. The focused unit test pass, and I have tested on a live install and verified the effectiveness of the fix.

Please follow this checklist to avoid unnecessary back and forth (click to expand)
  • ⚠️ If there are Breaking change (a fix or feature that alters existing functionality in a way that could cause issues) I have called them out
  • 🧠 I have disclosed any use of LLMs/AI in this contribution and reviewed all generated content.
    I understand that I am responsible for and able to explain every line of code I submit.
  • 🔍 Any UI changes adhere to visual style of this project.
  • 🛠️ I have self-reviewed and self-tested my code to ensure it works as expected.
  • 📝 I have commented my code, especially in hard-to-understand areas (e.g., using JSDoc for methods).
  • 🤖 I added or updated automated tests where appropriate.
  • 📄 Documentation updates are included (if applicable).
  • 🧰 Dependency updates are listed and explained.
  • ⚠️ CI passes and is green. PENDING.

@github-actions

Copy link
Copy Markdown
Contributor

Thanks for the PR! If anyone would like to help with testing, run: npx kuma-pr larsch:fix/mqtt-json-query-error (requires Node.js and Docker)

@github-actions

Copy link
Copy Markdown
Contributor

Hello and thanks for lending a paw to Uptime Kuma! 🐻👋
As this is your first contribution, please be sure to check out our Pull Request guidelines.
In particular: - Mark your PR as Draft while you’re still making changes - Mark it as Ready for review once it’s fully ready
If you have any design or process questions, feel free to ask them right here in this pull request - unclear documentation is a bug too.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MQTT JSON query conditions treat expression errors as zero

1 participant