Skip to content

create_container (remote REST/gRPC path) fails with generic 500 "driver stage" error while local CLI create succeeds #1001

Description

@hsinatfootprintai

Summary

Creating a container via the remote API (MCP tool create_container, which goes through the daemon's REST/gRPC path) fails consistently with a generic, unhelpful error:

API error (status 500): {"code":13,"message":"create container failed (stage: driver)","details":[]}

The exact same logical operation - creating a container on the same backend, same host - succeeds immediately when run locally on the backend host via the CLI:

sudo containarium create mlops-dev-container --no-ssh-key --podman -v
✓ Container mlops-dev-container-container created successfully!

Environment

  • Backend: tunnel-ubuntu-VirtualBox (a byoc backend, tunnel-connected)
  • containarium doctor on that host: all checks pass (root, capabilities, writable paths, useradd/userdel probe, incus binary present)
  • incus daemon itself: healthy, running for 1+ week, storage pool default (driver dir) in CREATED state
  • Disk space on the host: not the cause - confirmed healthy (39% used) at the time of the failing remote attempts

Reproduction

  1. Via MCP create_container tool (or equivalent REST/gRPC call), with username=mlops-dev-container, backend_id=tunnel-ubuntu-VirtualBox, cpu=4, memory=4GB, disk=50GB (no ssh_keys passed - relying on the tool's documented ephemeral-keypair-generation fallback).
  2. Request fails every time with the generic 500 "driver stage" error above. Retried twice, identical failure both times.
  3. SSH'd directly into the backend host and ran the equivalent containarium create <user> --no-ssh-key --podman -v locally - succeeded on the first try, no errors.

Suspicious secondary finding: local-CLI-created containers aren't registered with the platform

After the local CLI create succeeded, the container is:

  • Visible and running via incus list on the host.
  • Not visible via the platform's own list_containers (MCP tool) - the container simply doesn't appear in the list.
  • get_container(username=mlops-dev-container) returns 404 container not found.

This suggests the REST/gRPC create path does some additional step beyond what the local CLI path does (most likely: registering the container in a central database/control-plane, and/or the SSH-key provisioning path when ssh_keys is omitted and an ephemeral keypair needs to be generated server-side). My working theory is that this extra step is exactly what's failing with the generic "driver stage" error, since the container creation itself (the actual incus/LXC provisioning) clearly works fine when done directly.

Impact

  • Any create_container call without host-local CLI access is silently broken for this backend (and possibly others using the same byoc/tunnel code path).
  • The generic "stage: driver" error message gives no actionable diagnostic information - it should surface the underlying cause (e.g. which specific step failed: incus provisioning itself vs. SSH key injection vs. platform registration vs. something else).

Suggested next steps

  1. Reproduce with server-side debug/verbose logging enabled for the REST/gRPC create path specifically (not just the local CLI's -v flag, which apparently takes a different code path and doesn't fail).
  2. Compare the two code paths (local CLI create command vs. the daemon's REST/gRPC handler for the same operation) to find what the remote path does that the local path doesn't - the divergence is likely where the bug lives.
  3. Improve the error surfaced at the "driver stage" to include the underlying error message rather than just {"code":13,"message":"create container failed (stage: driver)","details":[]}.

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