#1956·kamal

Boot silently skips roles when parallel_roles is false and servers use user@host strings

Author: samwareeCreated Sep 27, 2026Updated Sep 27, 2026

Steps to reproduce

Use appuser@host server strings (non-root SSH user) with roles on a single host and boot.parallel_roles: false (the default):

yaml
servers:
  web:
    - [email protected]
boot:
  parallel_roles: false

kamal app boot (and deploy) silently does nothing: it prints "Start container with version ..." then goes straight to "Tagging ... as the latest image". No container is created, no error is raised.

Root cause

SSHKitDslRoles#on_roles sequential branch (lib/kamal/sshkit_with_ext.rb:258-262):

ruby
on(hosts) do |host|
  roles.each do |role|
    instance_exec(host, role, &block) if role.hosts.include?(host.to_s)
  end
end

host is an SSHKit::Host, so host.to_s is only the hostname (192.168.12.100), while role.hosts contains the configured string with the user ([email protected]). include? is always false, so the block body never runs for any role.

The parallel branch (role.hosts & hosts) works because both sides are plain strings there; the bug only shows with parallel_roles: false and user-qualified server strings.

Expected behavior

Boot should run the role on the host. host.to_s should be compared consistently with how hosts are stored in role config, e.g. role.hosts.include?(host.user ? "#{host.user}@#{host.hostname}" : host.hostname) or by storing SSHKit::Host objects in role.tagged_hosts.

Workaround

boot: { parallel_roles: true } (parallel branch matches on strings) — but that path has a second issue: role.env_tags(host) fetches tagged_hosts (keyed by config strings) with the SSHKit::Host object, raising key not found: #<SSHKit::Host ...> whenever a host has no tags. That is benign for hosts without tags if rescued, but it kills boot outright as written.