saltstack / saltstack/salt

[Bug]: pkg mod_aggregate fails when a version is specified in pkgs list

Open
#69,736 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
15.7k
Forks
5.6k
Avg merge
2d 44m
Merged PRs (30d)
80

Description

What happened?

In salt 3008.x mod_aggregate for the pkg state will fail if a version is specified in the pkgs argument to pkg.installed with this stack trace:

ValueError: too many values to unpack (expected 2)
Traceback (most recent call last):
  File "/bin/salt-call", line 12, in <module>
    sys.exit(salt_call())
             ~~~~~~~~~^^
  File "/opt/saltstack/salt/lib/python3.14/site-packages/salt/scripts.py", line 520, in salt_call
    client.run()
    ~~~~~~~~~~^^
  File "/opt/saltstack/salt/lib/python3.14/site-packages/salt/cli/call.py", line 149, in run
    caller.run()
    ~~~~~~~~~~^^
  File "/opt/saltstack/salt/lib/python3.14/site-packages/salt/cli/caller.py", line 95, in run
    ret = self.call()
  File "/opt/saltstack/salt/lib/python3.14/site-packages/salt/cli/caller.py", line 202, in call
    ret["return"] = self.minion.executors[fname](
                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
        self.opts, data, func, args, kwargs
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/opt/saltstack/salt/lib/python3.14/site-packages/salt/loader/lazy.py", line 177, in __call__
    ret = self.loader.run(run_func, *args, **kwargs)
  File "/opt/saltstack/salt/lib/python3.14/site-packages/salt/loader/lazy.py", line 1480, in run
    return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
           ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/saltstack/salt/lib/python3.14/site-packages/salt/loader/lazy.py", line 1495, in _run_as
    ret = _func_or_method(*args, **kwargs)
  File "/opt/saltstack/salt/lib/python3.14/site-packages/salt/executors/direct_call.py", line 10, in execute
    return func(*args, **kwargs)
  File "/opt/saltstack/salt/lib/python3.14/site-packages/salt/loader/lazy.py", line 177, in __call__
    ret = self.loader.run(run_func, *args, **kwargs)
  File "/opt/saltstack/salt/lib/python3.14/site-packages/salt/loader/lazy.py", line 1480, in run
    return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
           ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/saltstack/salt/lib/python3.14/site-packages/salt/loader/lazy.py", line 1495, in _run_as
    ret = _func_or_method(*args, **kwargs)
  File "/opt/saltstack/salt/lib/python3.14/site-packages/salt/modules/state.py", line 983, in apply_
    return highstate(**kwargs)
  File "/opt/saltstack/salt/lib/python3.14/site-packages/salt/modules/state.py", line 1334, in highstate
    ret = st_.call_highstate(
        exclude=kwargs.get("exclude", []),
    ...<4 lines>...
        orchestration_jid=orchestration_jid,
    )
  File "/opt/saltstack/salt/lib/python3.14/site-packages/salt/state.py", line 4785, in call_highstate
    return self.state.call_high(high, orchestration_jid)
           ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/saltstack/salt/lib/python3.14/site-packages/salt/state.py", line 3448, in call_high
    ret = self.call_chunks(chunks, disabled_states=self.disabled_states)
  File "/opt/saltstack/salt/lib/python3.14/site-packages/salt/state.py", line 2742, in call_chunks
    running, pending = self.call_chunk(low, running, chunks)
                       ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/saltstack/salt/lib/python3.14/site-packages/salt/state.py", line 3059, in call_chunk
    low = self._mod_aggregate(low, running)
  File "/opt/saltstack/salt/lib/python3.14/site-packages/salt/state.py", line 1047, in _mod_aggregate
    low = self.states[agg_fun](low, aggregate_chunks, running)
  File "/opt/saltstack/salt/lib/python3.14/site-packages/salt/loader/lazy.py", line 177, in __call__
    ret = self.loader.run(run_func, *args, **kwargs)
  File "/opt/saltstack/salt/lib/python3.14/site-packages/salt/loader/lazy.py", line 1480, in run
    return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
           ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/saltstack/salt/lib/python3.14/site-packages/salt/loader/lazy.py", line 1495, in _run_as
    ret = _func_or_method(*args, **kwargs)
  File "/opt/saltstack/salt/lib/python3.14/site-packages/salt/states/pkg.py", line 3696, in mod_aggregate
    _combine_pkgs(low_pkgs, low.get(pkg_type, []))
    ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/saltstack/salt/lib/python3.14/site-packages/salt/states/pkg.py", line 3715, in _combine_pkgs
    for pkg, version in item:
        ^^^^^^^^^^^^
ValueError: too many values to unpack (expected 2)
Traceback (most recent call last):
  File "/bin/salt-call", line 12, in <module>
    sys.exit(salt_call())
             ~~~~~~~~~^^
  File "/opt/saltstack/salt/lib/python3.14/site-packages/salt/scripts.py", line 520, in salt_call
    client.run()
    ~~~~~~~~~~^^
  File "/opt/saltstack/salt/lib/python3.14/site-packages/salt/cli/call.py", line 149, in run
    caller.run()
    ~~~~~~~~~~^^
  File "/opt/saltstack/salt/lib/python3.14/site-packages/salt/cli/caller.py", line 95, in run
    ret = self.call()
  File "/opt/saltstack/salt/lib/python3.14/site-packages/salt/cli/caller.py", line 202, in call
    ret["return"] = self.minion.executors[fname](
                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
        self.opts, data, func, args, kwargs
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/opt/saltstack/salt/lib/python3.14/site-packages/salt/loader/lazy.py", line 177, in __call__
    ret = self.loader.run(run_func, *args, **kwargs)
  File "/opt/saltstack/salt/lib/python3.14/site-packages/salt/loader/lazy.py", line 1480, in run
    return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
           ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/saltstack/salt/lib/python3.14/site-packages/salt/loader/lazy.py", line 1495, in _run_as
    ret = _func_or_method(*args, **kwargs)
  File "/opt/saltstack/salt/lib/python3.14/site-packages/salt/executors/direct_call.py", line 10, in execute
    return func(*args, **kwargs)
  File "/opt/saltstack/salt/lib/python3.14/site-packages/salt/loader/lazy.py", line 177, in __call__
    ret = self.loader.run(run_func, *args, **kwargs)
  File "/opt/saltstack/salt/lib/python3.14/site-packages/salt/loader/lazy.py", line 1480, in run
    return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
           ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/saltstack/salt/lib/python3.14/site-packages/salt/loader/lazy.py", line 1495, in _run_as
    ret = _func_or_method(*args, **kwargs)
  File "/opt/saltstack/salt/lib/python3.14/site-packages/salt/modules/state.py", line 983, in apply_
    return highstate(**kwargs)
  File "/opt/saltstack/salt/lib/python3.14/site-packages/salt/modules/state.py", line 1334, in highstate
    ret = st_.call_highstate(
        exclude=kwargs.get("exclude", []),
    ...<4 lines>...
        orchestration_jid=orchestration_jid,
    )
  File "/opt/saltstack/salt/lib/python3.14/site-packages/salt/state.py", line 4785, in call_highstate
    return self.state.call_high(high, orchestration_jid)
           ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/saltstack/salt/lib/python3.14/site-packages/salt/state.py", line 3448, in call_high
    ret = self.call_chunks(chunks, disabled_states=self.disabled_states)
  File "/opt/saltstack/salt/lib/python3.14/site-packages/salt/state.py", line 2742, in call_chunks
    running, pending = self.call_chunk(low, running, chunks)
                       ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/saltstack/salt/lib/python3.14/site-packages/salt/state.py", line 3059, in call_chunk
    low = self._mod_aggregate(low, running)
  File "/opt/saltstack/salt/lib/python3.14/site-packages/salt/state.py", line 1047, in _mod_aggregate
    low = self.states[agg_fun](low, aggregate_chunks, running)
  File "/opt/saltstack/salt/lib/python3.14/site-packages/salt/loader/lazy.py", line 177, in __call__
    ret = self.loader.run(run_func, *args, **kwargs)
  File "/opt/saltstack/salt/lib/python3.14/site-packages/salt/loader/lazy.py", line 1480, in run
    return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
           ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/saltstack/salt/lib/python3.14/site-packages/salt/loader/lazy.py", line 1495, in _run_as
    ret = _func_or_method(*args, **kwargs)
  File "/opt/saltstack/salt/lib/python3.14/site-packages/salt/states/pkg.py", line 3696, in mod_aggregate
    _combine_pkgs(low_pkgs, low.get(pkg_type, []))
    ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/saltstack/salt/lib/python3.14/site-packages/salt/states/pkg.py", line 3715, in _combine_pkgs
    for pkg, version in item:
        ^^^^^^^^^^^^
ValueError: too many values to unpack (expected 2)

Steps to reproduce

cat > /srv/salt/test.sls <<'EOF'
pkg1:
  pkg.installed:
    - pkgs:
      - hyphen: '2.8.8'
    - aggregate: True

pkg2:
  pkg.installed:
    - name: hello
    - aggregate: True
EOF
salt-call --local state.apply test
Type of salt install

Official rpm

Major version

3007.x

What supported OS are you seeing the problem on? Can select multiple. (If bug appears on an unsupported OS, please open a GitHub Discussion instead)

rockylinux-10

salt --versions-report output
Salt Version:
          Salt: 3008.2

Python Version:
        Python: 3.14.6 (main, Jun 11 2026, 02:19:05) [GCC 11.2.0]

Dependency Versions:
          cffi: 2.0.0
      cherrypy: 18.10.0
  cryptography: 48.0.0
      dateutil: 2.9.0.post0
     docker-py: Not Installed
         gitdb: 4.0.12
     gitpython: Not Installed
        Jinja2: 3.1.6
       libgit2: Not Installed
  looseversion: 1.3.0
      M2Crypto: Not Installed
          Mako: Not Installed
       msgpack: 1.1.2
  msgpack-pure: Not Installed
  mysql-python: Not Installed
     packaging: 24.0
     pycparser: 3.00
      pycrypto: Not Installed
  pycryptodome: 3.23.0
        pygit2: Not Installed
  python-gnupg: 0.5.6
        PyYAML: 6.0.3
         PyZMQ: 27.1.0
        relenv: 0.22.14
         smmap: 5.0.2
       timelib: 0.3.0
       Tornado: 6.5.7
           ZMQ: 4.3.5

Salt Package Information:
  Package Type: onedir

System Versions:
          dist: rocky 10.0 Red Quartz
        locale: utf-8
       machine: x86_64
       release: 6.12.0-55.32.1.el10_0.x86_64
        system: Linux
       version: Rocky Linux 10.0 Red Quartz

Contributor guide

Open the contributing guide

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.

Research direction

Start in salt/states/pkg.py at mod_aggregate and _combine_pkgs, then reproduce the failure with the provided test.sls and salt-call --local state.apply test command. The work is done when a versioned package in pkgs aggregates without the ValueError and the unversioned package still works.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
devops, infrastructure
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
70/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.