Skip to content

update-module: KeyError crash in 95cleanup_images when PREV_IMAGE_URL is unset #8180

Closed

Description

@danb35

Steps to reproduce

  • Install a module from a floating tag, for example add-module ghcr.io/danb35/automx:latest
  • Without ever updating that module instance, run update-module ghcr.io/danb35/automx:latest automx1, using the same image URL that is already installed and without the --force option

Expected behavior

The update is skipped with the warning "The module URL ... is already installed", and the task completes successfully.

Actual behavior

The module update-module task aborts at step 95cleanup_images with KeyError: 'PREV_IMAGE_URL'. As a result, the cluster update-module task reports the instance as failed.

Journal excerpt (module id automx1):

task/module/automx1/f3ca9040-b007-4b63-89c2-31944811759d: update-module/95cleanup_images is starting
Removing None (differs from ghcr.io/danb35/automx:latest)
Traceback (most recent call last):
  File "/usr/local/agent/actions/update-module/95cleanup_images", line 32, in <module>
    agent.run_helper('podman', 'image', 'rm', os.environ[image_old])
                                                ~~~~~~~~~~^^^^^^^^^^^
KeyError: 'PREV_IMAGE_URL'
task/module/automx1/f3ca9040-b007-4b63-89c2-31944811759d: action "update-module" status is "aborted" (1) at step 95cleanup_images

Components

NS8 core, update-module action. Found with the module ghcr.io/danb35/automx, but any module can be affected.

See also

Found while updating the ghcr.io/danb35/automx module on a real node.

Activity

  1. DavidePrincipi commented on Oct 6, 2026

    @DavidePrincipi
    Member

    Thanks for the detailed report. The reproduction steps were missing one condition: the crash happens only when the requested image URL is the same one already installed, and --force isn't used.

    Steps to reproduce

    1. Install a module from a floating tag, e.g. add-module ghcr.io/danb35/automx:latest
    2. Without ever updating that instance, run update-module ghcr.io/danb35/automx:latest automx1 (without --force)

    Expected: the update is skipped with the "already installed" warning and the task succeeds.

    Actual: update-module/95cleanup_images aborts with KeyError: 'PREV_IMAGE_URL', and the cluster update-module task fails.

    @danb35 may I edit the issue description to include these corrected steps?

  2. danb35 commented on Oct 6, 2026

    @danb35
    Author

    @danb35 may I edit the issue description to include these corrected steps?

    No objection from me.

  3. added this to the NethServer 8.11 milestone on Oct 6, 2026
  4. DavidePrincipi commented on Oct 8, 2026

    @DavidePrincipi
    Member

    In Testing core 3.23.1-dev.1

    Test case 1

    Test the bug is not reproducible:

    • Install/Update core 3.23.1-dev.1: update-core ghcr.io/nethserver/core:3.23.1-dev.1
    • Install a module from a floating tag, e.g. add-module ghcr.io/nethserver/dokuwiki:latest 1
    • Without updating it first, run update-module ghcr.io/nethserver/dokuwiki:latest dokuwiki1

    The task completes successfully with the "already installed" warning.

    Update a module to a stable version and check that the previous image is still removed.

    @danb35 would you mind testing it?

  5. removed their assignment
    on Oct 8, 2026
  6. added
    testing
    on Oct 8, 2026
  7. DavidePrincipi commented on Oct 12, 2026

    @DavidePrincipi
    Member

    VERIFIED

  8. added
    verified
    on Oct 12, 2026
  9. removed their assignment
    on Oct 12, 2026
  10. removed
    testing
    on Oct 12, 2026
  11. moved this from Testing to Verified in NethServeron Oct 12, 2026
  12. moved this from Verified to Done in NethServeron Oct 15, 2026
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

    verified

    Type

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions