Skip to content

Sandbox.start() crashes with TypeError: APIError.__init__() missing 1 required positional argument: "message" when image is missing #74

Description

@laohuan12138

Description

Running deadend --target <url> fails immediately with:

Failed to instantiate agent: Failed to create sandbox: APIError.__init__() missing 1 required positional argument: 'message'

Root cause

Two layers:

  1. Missing sandbox imagexoxruns/sandboxed_kali could not be pulled (Docker Hub unreachable in our environment). RPC server log (~/.cache/deadend/logs/rpc-server-*.log):

    Error pulling sandboxed Kali image: 500 Server Error ... "Get "https://registry-1.docker.io/v2/": context deadline exceeded"
    Image not found xoxruns/sandboxed_kali
    Failed to create sandbox: APIError.__init__() missing 1 required positional argument: 'message'
    
  2. Bug masking the real error — in deadend_agent/src/deadend_agent/sandbox/sandbox.py, Sandbox.start() re-raises docker exceptions by constructing a new exception with no message:

    except ImageNotFound as exc:
        logger.error("Image not found %s", container_image)
        raise ImageNotFound from exc      # ImageNotFound() → APIError() → TypeError
    except NotFound as exc:
        logger.error("Docker error: %s", exc.explanation)
        raise NotFound from exc

    docker.errors.ImageNotFound / NotFound inherit APIError, whose __init__(self, message, response=None, explanation=None) requires message. Constructing ImageNotFound() with no args raises TypeError: APIError.__init__() missing 1 required positional argument: 'message', completely masking the real ImageNotFound and making the actual problem impossible to diagnose. Reproduced with docker SDK 7.1.0:

    >>> raise ImageNotFound from None
    TypeError: APIError.__init__() missing 1 required positional argument: 'message'

Expected behavior

Re-raise the original exception (raise exc) so callers see the actual docker.errors.ImageNotFound with its explanation.

Environment

  • deadend CLI (OpenTUI rewrite, current main)
  • docker SDK 7.1.0 (bundled)
  • Linux (WSL2 / Kali)

Activity

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