The JSON Error That Hid the Real Failure
This is a submission for DEV's Summer Bug Smash: Smash Stories powered by Sentry . A migration audit should fail loudly when data is lost. Mine failed loudly too—but, in one edge case, it reported the wrong failure . The bug lived in a one-command Python showcase built for an open-source Memanto contribution. The command turns a real GitHub discussion into an Open Knowledge Format bundle, runs…
A migration audit tool failed unexpectedly in a test case, presenting the wrong error message. The issue arose from a Python script designed to convert a GitHub discussion into an Open Knowledge Format bundle and run a migration dry run. The script produced a JSON receipt, but when the audit failed without producing valid JSON, the script masked the original error and did not write the receipt.
This led to a third failure scenario, where the audit process exited with a non-zero status but produced plain text instead of JSON. To address this, the code was updated to handle two independent signals: the process's success and the validity of its JSON output. The updated code first checked for successful process execution and valid JSON, then raised the appropriate exception with the correct exit code.
If the JSON parsing failed, the original process error was raised, preserving the diagnostic information. The fix ensures that when the pipeline fails, its diagnostic contract is reliable, with explicit regression tests verifying both failure modes. After the fix, the test suite passed successfully, and a real data round trip demonstrated zero removed or changed fields.
The most important outcome is that when the pipeline fails, its diagnostic contract is now trustworthy.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.



