dagger/dagger · error
parse runner host: %w
Error message
parse runner host: %w
What it means
Wraps a failure of url.Parse(c.RunnerHost) at the top of startEngine. Before selecting a driver, the client parses the runner host string as a URL to read its scheme; if the string is not a valid absolute URL (bad scheme syntax, control characters, missing scheme), parsing fails and the connect is aborted.
Source
Thrown at engine/client/client.go:455
c.sessionSrv.Stop()
}
}()
if err := c.subscribeTelemetry(connectCtx); err != nil {
return nil, fmt.Errorf("subscribe to telemetry: %w", err)
}
if err := c.daggerConnect(ctx); err != nil {
return nil, fmt.Errorf("failed to connect to dagger: %w", err)
}
return c, nil
}
func (c *Client) startEngine(ctx context.Context, params Params) (rerr error) {
remote, err := url.Parse(c.RunnerHost)
if err != nil {
return fmt.Errorf("parse runner host: %w", err)
}
driver, err := drivers.GetDriver(ctx, remote.Scheme)
if err != nil {
return err
}
var cloudToken string
if v, ok := os.LookupEnv(drivers.EnvDaggerCloudToken); ok {
cloudToken = v
} else if _, ok := os.LookupEnv(envDaggerCloudCachetoken); ok {
cloudToken = v
}
if c.CloudURLCallback != nil {
if url, msg, ok := enginetel.URLForTrace(ctx); ok {
c.CloudURLCallback(ctx, url, msg, ok)
} else {View on GitHub (pinned to 82ba2681db)
Solutions
- Print and fix the RunnerHost value; ensure it is a valid URL like docker://engine or udp://1.2.3.4
- Check the env var feeding RunnerHost (e.g. DAGGER_RUNNER_HOST) for typos/extra characters
- Quote the value in shell/scripts to avoid stray spaces
Example fix
// before
os.Setenv("DAGGER_RUNNER_HOST", "docker//my-engine")
client, err := dagger.Connect(ctx)
// after
os.Setenv("DAGGER_RUNNER_HOST", "docker-container://my-engine")
client, err := dagger.Connect(ctx) Defensive patterns
Strategy: validation
Validate before calling
runnerHost := os.Getenv("DAGGER_RUNNER_HOST")
if u, err := url.Parse(runnerHost); err != nil || u.Scheme == "" {
return fmt.Errorf("DAGGER_RUNNER_HOST %q is not a valid URL with a scheme", runnerHost)
} Type guard
func isValidRunnerHost(s string) bool {
u, err := url.Parse(s)
return err == nil && u.Scheme != ""
} Try / catch
client, err := dagger.Connect(ctx)
if err != nil && strings.Contains(err.Error(), "parse runner host") {
return fmt.Errorf("check DAGGER_RUNNER_HOST: %w", err)
} Prevention
- Validate runner host with url.Parse before calling Connect
- Quote env values in scripts to avoid stray spaces
- Use the documented scheme format (e.g. docker-container://name)
- Test env-var templating in CI configs
When it happens
Trigger: Calling Connect or ConnectEngineToEngine with a Params.RunnerHost (or env-provided runner host) that is not a parseable URL — e.g. "docker:/", spaces, or garbage strings.
Common situations: Typo'd DAGGER_RUNNER_HOST value (e.g. missing colon: "docker//container"); shell interpolation injecting whitespace; environment variable set from a mis-templated config.
Understand the failure class
Background: "Invalid URL" / "URL cannot be empty": fix the malformed or missing URL behind request-construction failures — this error's family across 50 libraries.
Related errors
- parse local endpoint URL: %w
- parse port %q from %s: %w
- parse git URL %q: %w
- sshfs endpoint missing user
- sshfs endpoint missing host
AI-assisted analysis of dagger/dagger@82ba2681db (2026-09-05).
Data as JSON: /api/errors/b4f06f3128f01585.
Report an issue: GitHub.