Skip to content

Fix batch mode treating error payloads as minion IDs#68672

Open
d3zorg wants to merge 2 commits intosaltstack:masterfrom
d3zorg:fix-batch-error-minion
Open

Fix batch mode treating error payloads as minion IDs#68672
d3zorg wants to merge 2 commits intosaltstack:masterfrom
d3zorg:fix-batch-error-minion

Conversation

@d3zorg
Copy link

@d3zorg d3zorg commented Feb 2, 2026

What does this PR do?

Batch mode could incorrectly treat transport-level error payloads (e.g. {"error": "...", "failed": True}) as valid minion IDs, leading to spurious "Minion 'error' failed to respond" messages and incorrect batch tracking.

What issues does this PR fix or reference?

Issues: #46876 #48509 #50238 #60724
PRs: #53159 #54725 #54923

Previous Behavior

Running batched commands like salt -b4 *-minion* test.ping caused loads of extra errors that are not actual errors and minion payloads misinterpreted:

Executing run on ['minion1xxx', 'error', 'minion2xxx, 'minion3xxx']

minion error was already deleted from tracker, probably a duplicate key
minion error was already deleted from tracker, probably a duplicate key
minion error was already deleted from tracker, probably a duplicate key
minion error was already deleted from tracker, probably a duplicate key
[ERROR   ] An un-handled exception was caught by Salt's global exception handler:
KeyError: 'ret'
Traceback (most recent call last):
  File "/usr/bin/salt", line 12, in <module>
    sys.exit(salt_main())
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/scripts.py", line 529, in salt_main
    client.run()
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/cli/salt.py", line 55, in run
    self._run_batch()
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/cli/salt.py", line 291, in _run_batch
    for res, job_retcode in batch.run():
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/cli/batch.py", line 326, in run
    ret[minion] = data["ret"]
KeyError: 'ret'
Traceback (most recent call last):
  File "/usr/bin/salt", line 12, in <module>
    sys.exit(salt_main())
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/scripts.py", line 529, in salt_main
    client.run()
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/cli/salt.py", line 55, in run
    self._run_batch()
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/cli/salt.py", line 291, in _run_batch
    for res, job_retcode in batch.run():
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/cli/batch.py", line 326, in run
    ret[minion] = data["ret"]
KeyError: 'ret'

New Behavior

Receiving proper execution list without tons of errors and failing halfway through minion list:

Executing run on ['minion1xxx', 'minion4xxx', 'minion2xxx, 'minion3xxx']
...
jid:
    20260130100634363546
retcode:
    0
minion4xxx:
    True
jid:
    20260130100634363546
retcode:
   0
....

Merge requirements satisfied?

[NOTICE] Bug fixes or features added to Salt require tests.

Commits signed with GPG?

No

@d3zorg d3zorg requested a review from a team as a code owner February 2, 2026 10:21
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.

2 participants