nektos/act · error
Cannot merge container.Config options: '%s': '%w'
Error message
Cannot merge container.Config options: '%s': '%w'
What it means
mergeContainerConfigs merges the user's parsed container.Config over act's defaults with mergo (WithOverride). If mergo reports an error, the merge is aborted and 'Cannot merge container.Config options' is returned with the raw options string. mergo only errors on unsupported target kinds, so in practice this indicates struct wiring problems rather than user input.
Source
Thrown at pkg/container/docker_run.go:391
return nil, nil, fmt.Errorf("Cannot parse container options: '%s': '%w'", input.Options, err)
}
if len(copts.netMode.Value()) == 0 {
if err = copts.netMode.Set(cr.input.NetworkMode); err != nil {
return nil, nil, fmt.Errorf("Cannot parse networkmode=%s. This is an internal error and should not happen: '%w'", cr.input.NetworkMode, err)
}
}
containerConfig, err := parse(flags, copts, runtime.GOOS)
if err != nil {
return nil, nil, fmt.Errorf("Cannot process container options: '%s': '%w'", input.Options, err)
}
logger.Debugf("Custom container.Config from options ==> %+v", containerConfig.Config)
err = mergo.Merge(config, containerConfig.Config, mergo.WithOverride)
if err != nil {
return nil, nil, fmt.Errorf("Cannot merge container.Config options: '%s': '%w'", input.Options, err)
}
logger.Debugf("Merged container.Config ==> %+v", config)
logger.Debugf("Custom container.HostConfig from options ==> %+v", containerConfig.HostConfig)
hostConfig.Binds = append(hostConfig.Binds, containerConfig.HostConfig.Binds...)
hostConfig.Mounts = append(hostConfig.Mounts, containerConfig.HostConfig.Mounts...)
binds := hostConfig.Binds
mounts := hostConfig.Mounts
err = mergo.Merge(hostConfig, containerConfig.HostConfig, mergo.WithOverride)
if err != nil {
return nil, nil, fmt.Errorf("Cannot merge container.HostConfig options: '%s': '%w'", input.Options, err)
}
hostConfig.Binds = binds
hostConfig.Mounts = mounts
logger.Debugf("Merged container.HostConfig ==> %+v", hostConfig)
return config, hostConfig, nilView on GitHub (pinned to 4f41128141)
Solutions
- Update act to the latest release — dependency/type mismatches are fixed there
- If it persists, report upstream with the exact options string and versions (act --version, docker info)
- Retry with empty container.options to confirm the options pipeline vs. a deeper regression
Defensive patterns
Strategy: fallback
Validate before calling
# shell: bisect the cause — empty options should never trigger this act -P ubuntu-latest=-self-hosted --container-options '' 2>&1 | grep -i merge || echo "merge path OK"
Try / catch
// Go: internal merge failure — fall back to defaults, surface details
if err := runnerExec(ctx); err != nil && strings.Contains(err.Error(), "Cannot merge container.Config") {
log.Error("act/container merge regression — retry with empty container.options and report upstream")
} Prevention
- Keep act updated; merge/type regressions are fixed in releases
- Pin act versions in CI and test upgrades before rolling out
- Report reproduce steps (options string + versions) upstream when hit
When it happens
Trigger: mergo.Merge failing on the config struct — realistically triggered by version mismatches between act and its vendored mergo/moby types (changed field kinds), not by any specific user option value.
Common situations: Seen after upgrading act or its dependencies where container.Config types shifted; essentially an internal invariant failure surfaced through the options pipeline.
Related errors
- network-scoped aliases are only supported for user-defined n
- invalid storage option
- valid streams are STDIN, STDOUT and STDERR
- %s is not a valid mac address
- network %q is specified multiple times
AI-assisted analysis of nektos/act@4f41128141 (2026-08-15).
Data as JSON: /api/errors/7dc322f09a4a0a99.
Report an issue: GitHub.