<#9258 fix: Avoid writing empty state after an inv...
# meltano-repo-activity
g
#9258 fix: Avoid writing empty state after an invalid STATE message Pull request opened by joaopamaral ## Description This pull request includes a change to the
writeline
method in
src/meltano/core/plugin/singer/target.py
. The change ensures that only valid states are saved, preventing potential overwrites of existing valid states when the incoming state message is incorrect (which makes new state empty). Here is an example of this failure in logs (extraction failed after it and state was empty):
Copy code
2025-04-21T16:14:46.146989Z [warning  ] Received state is invalid, incremental state has not been updated
2025-04-21T16:14:46.215886Z [info     ] Incremental state has been updated at 2025-04-21 16:14:46.215847+00:00.

+ meltano state get STATE_ID
{"singer_state": {}}
## Related Issues • Closes #XXXX meltano/meltano