#9821·Lean

Optimizer cannot run backtests in the linux/arm64 Docker image: QuantConnect.Lean.Launcher apphost is x86-64

Author: AlexCatarinoCreated Sep 23, 2026Updated Sep 23, 2026

Summary

lean optimize cannot run any backtest inside the linux/arm64 variant of the quantconnect/lean Docker image. Every parameter set ends with

LeanOptimizer.NewResult(...): Got null/empty backtest result for backtest id '<guid>'

while lean backtest on the same machine works. Reported from Windows 11 ARM64 with Docker Desktop 29.8.0 and Lean CLI 1.0.229.

Cause

ConsoleLeanOptimizer starts each backtest by executing the Launcher apphost directly (Optimizer.Launcher/ConsoleLeanOptimizer.cs, lines 49-51 and 89-95):

csharp
_leanLocation = Configuration.Config.Get("lean-binaries-location",
    Path.Combine(Directory.GetCurrentDirectory(), "../../../Launcher/bin/Debug/QuantConnect.Lean.Launcher"));
...
var startInfo = new ProcessStartInfo { FileName = _leanLocation, ... };

In the published linux/arm64 image that apphost is an x86-64 binary:

  • quantconnect/lean:latest index, arm64 manifest sha256:1ac9766b4af494b6cfa5439fae0aad46df1af810455db84b277f9d2d391cb32d, image created 2026-09-23T17:11:15Z.
  • Layer 27 (COPY ./Lean/Launcher/bin/Debug/ /Lean/Launcher/bin/Debug/), digest sha256:0360cf0b1cc2..., extracted /Lean/Launcher/bin/Debug/QuantConnect.Lean.Launcher: ELF64, e_machine = 0x3E (x86-64).
  • The same layer in the amd64 manifest (sha256:625d675202f8...) is 25,599,335 bytes gzipped versus 25,599,364 for arm64, i.e. the arm64 image ships the x64 build output. The image's .NET runtime itself is arm64 (DockerfileLeanFoundationARM installs it with dotnet-install.sh on the ARM host).

The Dockerfile copies a pre-built Launcher/bin/Debug/ into both images, and dotnet build generates the apphost for the build machine's RID, so an x64 build machine yields an x64 QuantConnect.Lean.Launcher in the arm64 image.

The optimizer's child process therefore either fails to exec (ENOEXEC, surfaced by the catch in LeanOptimizer.LaunchLeanForParameterSet) or, where Docker Desktop has binfmt emulation registered, runs an x64 apphost that cannot find an x64 runtime and exits without writing <backtestId>.json, so NewResult receives null. Both end as failed backtests.

lean backtest is unaffected because the CLI runs dotnet QuantConnect.Lean.Launcher.dll (lean/components/docker/lean_runner.py, line 140); lean optimize runs dotnet QuantConnect.Optimizer.Launcher.dll (lean/commands/optimize.py, line 337), and it is the optimizer that then spawns the apphost.

Proposed change

Either or both:

  1. Engine: make ConsoleLeanOptimizer start Lean the same way the Launcher's own entrypoint does: FileName = "dotnet", first argument <dir>/QuantConnect.Lean.Launcher.dll, keeping lean-binaries-location as an explicit override. This is architecture-neutral and removes the dependency on the apphost entirely.
  2. Image build: produce the arm64 image from an arm64 build (-r linux-arm64, or an arm64 build runner) so the apphost matches the image architecture.

Open questions

  • Is the arm64 image intentionally assembled from the x64 build output? If so, option 1 is the only fix.
  • The apphosts in Optimizer.Launcher/, Report/ and DownloaderDataProvider/ were not checked; they are started through dotnet by the CLI so they are not on this path.

Support reference: Intercom conversation 215476071298944.