GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — 'NoneType' is not iterable when running a Docker hook · Issue #3514 · pre-commit/pre-commit

'NoneType' is not iterable when running a Docker hook #3514

New issue
Copy link
New issue
Copy link
Closed
#3537
Closed
'NoneType' is not iterable when running a Docker hook#3514
#3537
Copy link

Description

@jenstroeger
jenstroeger
opened on Aug 19, 2025
Issue body actions

search you tried in the issue tracker

"not iterable", "Docker None"

describe your issue

This started happening after I updated pre-commit and Docker:

ShellCheck v0.11.0.......................................................An unexpected error has occurred: TypeError: argument of type 'NoneType' is not iterable
Check the log at /Users/jens/.cache/pre-commit/pre-commit.log
make: *** [Makefile:241: check] Error 3

With pre-commit v4.2.0 I now get

ShellCheck v0.11.0.......................................................Failed
- hook id: shellcheck
- exit code: 125

docker: request returned 500 Internal Server Error for API route and version http://%2FUsers%2Fjens%2F.docker%2Frun%2Fdocker.sock/_ping, check if the server supports the requested API version

which wasn’t the case previously. This is for

> docker --version
Docker version 28.3.2, build 578ccf6

but I’ve not tried an older version of Docker yet.

pre-commit --version

pre-commit 4.3.0

.pre-commit-config.yaml

- repo: https://github.com/koalaman/shellcheck-precommit
  rev: v0.11.0
  hooks:
  - id: shellcheck
    args: [--severity=warning]

~/.cache/pre-commit/pre-commit.log (if present)

version information

pre-commit version: 4.3.0
git --version: git version 2.50.1
sys.version:
    3.13.6 (main, Aug  9 2025, 06:37:32) [Clang 14.0.3 (clang-1403.0.22.14.1)]
sys.executable: /path/to/.venv/bin/python
os.name: posix
sys.platform: darwin

error information

An unexpected error has occurred: TypeError: argument of type 'NoneType' is not iterable
Traceback (most recent call last):
  File "/path/to/.venv/lib/python3.13/site-packages/pre_commit/error_handler.py", line 73, in error_handler
    yield
  File "/path/to/.venv/lib/python3.13/site-packages/pre_commit/main.py", line 417, in main
    return run(args.config, store, args)
  File "/path/to/.venv/lib/python3.13/site-packages/pre_commit/commands/run.py", line 444, in run
    return _run_hooks(config, hooks, skips, args)
  File "/path/to/.venv/lib/python3.13/site-packages/pre_commit/commands/run.py", line 296, in _run_hooks
    current_retval, prior_diff = _run_single_hook(
                                 ~~~~~~~~~~~~~~~~^
        classifier, hook, skips, cols, prior_diff,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        verbose=args.verbose, use_color=args.color,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/path/to/.venv/lib/python3.13/site-packages/pre_commit/commands/run.py", line 193, in _run_single_hook
    retcode, out = language.run_hook(
                   ~~~~~~~~~~~~~~~~~^
        hook.prefix,
        ^^^^^^^^^^^^
    ...<5 lines>...
        color=use_color,
        ^^^^^^^^^^^^^^^^
    )
    ^
  File "/path/to/.venv/lib/python3.13/site-packages/pre_commit/languages/docker_image.py", line 26, in run_hook
    cmd = docker_cmd(color=color) + lang_base.hook_cmd(entry, args)
          ~~~~~~~~~~^^^^^^^^^^^^^
  File "/path/to/.venv/lib/python3.13/site-packages/pre_commit/languages/docker.py", line 146, in docker_cmd
    *get_docker_user(),
     ~~~~~~~~~~~~~~~^^
  File "/path/to/.venv/lib/python3.13/site-packages/pre_commit/languages/docker.py", line 128, in get_docker_user
    if _is_rootless():
       ~~~~~~~~~~~~^^
  File "/path/to/.venv/lib/python3.13/site-packages/pre_commit/languages/docker.py", line 118, in _is_rootless
    'name=rootless' in info.get('SecurityOptions', ()) or
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: argument of type 'NoneType' is not iterable

Activity

  1. asottile commented on Aug 19, 2025

    @asottile
    asottile
    on Aug 19, 2025
    Member
    More actions

    can you show the output of 'docker' 'system' 'info' '--format' '{{ json . }}'

  2. jenstroeger commented on Aug 19, 2025

    @jenstroeger
    jenstroeger
    on Aug 19, 2025
    Author
    More actions

    There’s a bunch of private information there as well, do you have an email address I can send it to (instead of posting it here to the world)?

  3. asottile commented on Aug 20, 2025

    @asottile
    asottile
    on Aug 20, 2025
    Member
    More actions

    you can redact most of it I'm mostly interested in the bits near SecurityOptions if present

    Reacted by Sandor Torok
  4. jenstroeger commented on Aug 20, 2025

    @jenstroeger
    jenstroeger
    on Aug 20, 2025
    Author
    More actions

    Two points I’d like to make. One, here’s the information you asked for and SecurityOptions actually does exist:

    > docker system info --format json | jq
    {
      "ID": "fb62e55a-749a-40c7-9828-a7407756f5d7",
      "Containers": 2,
      "ContainersRunning": 0,
      "ContainersPaused": 0,
      "ContainersStopped": 2,
      "Images": 42,
      "Driver": "overlay2",
      "DriverStatus": [
    
      ...
    
      "SecurityOptions": [
        "name=seccomp,profile=builtin",
        "name=cgroupns"
      ],
    
      ...
    

    Two, Docker failed in all sorts of ways after the update I mentioned above so I restarted it. Now pre-commit works ok. Still, the failing

    pre-commit/pre_commit/languages/docker.py

    Lines 116 to 118 in e70b313

    # docker:
    # https://docs.docker.com/reference/api/engine/version/v1.48/#tag/System/operation/SystemInfo
    'name=rootless' in info.get('SecurityOptions', ()) or
    could be a

    info.get('SecurityOptions') or ()

    just to be on the safe side?

  5. asottile commented on Aug 20, 2025

    @asottile
    asottile
    on Aug 20, 2025
    Member
    More actions

    as far as I can tell it should never have "SecurityOptions": null and it looks like your output has a valid "SecurityOptions" now so unfortunately no reproduction :(

    Reacted by Sandor Torok
  6. jenstroeger commented on Aug 20, 2025

    @jenstroeger
    jenstroeger
    on Aug 20, 2025
    Author
    More actions

    Agree, and I’ve not had problems with updating Docker before. Perhaps we close this issue for now and in case this happens again we know what’s helpful to reproduce it.

  7. asottile commented on Aug 20, 2025

    @asottile
    asottile
    on Aug 20, 2025
    Member
    More actions

    sg2m!

  8. asottile
    closed this as completedon Aug 20, 2025
  9. jenstroeger commented on Aug 21, 2025

    @jenstroeger
    jenstroeger
    on Aug 21, 2025
    Author
    More actions

    Ok, I just updated Docker again and first thing I did was:

    > docker system info --format json | jq '.["SecurityOptions"]'
    [
      "name=seccomp,profile=builtin",
      "name=cgroupns"
    ]
    

    The Docker pre-commit hook worked immediately as well. I’ll keep an eye out in case this happens again.

  10. jenstroeger commented on Sep 1, 2025

    @jenstroeger
    jenstroeger
    on Sep 1, 2025
    Author
    More actions

    Interesting! I was just noodling along when Docker decided to stop working. So here we go:

    > docker system info --format json | jq '.["SecurityOptions"]'
    request returned 500 Internal Server Error for API route and version http://%2FUsers%2Fjens%2F.docker%2Frun%2Fdocker.sock/v1.51/info, check if the server supports the requested API version
    null
    

    I also kept the entire system info if you need it, which indeed contains

    {
      ...
      "SecurityOptions":null,
      ...
    }
    

    Have to restart Docker soon, though, because I’m blocked. But it turns out you can get the same result by just quitting Docker and then:

    > docker system info --format json | jq '.["SecurityOptions"]'
    Cannot connect to the Docker daemon at unix:///Users/jens/.docker/run/docker.sock. Is the docker daemon running?
    null
    
    Reacted by Sandor Torok
  11. asottile commented on Sep 6, 2025

    @asottile
    asottile
    on Sep 6, 2025
    Member
    More actions

    neat. quite surprising but neat. I assume docker was completely broken at that point but probably better for pre-commit to try a bit more so it at least points to docker being broken

  12. asottile
    reopened this on Sep 6, 2025
  13. asottile
    closed this as completedin #3537on Sep 6, 2025
  14. tmeijn
    added a commit that references this issue on Nov 14, 2025

    build(deps): update pre-commit to v4.4.0

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.