Skip to content

NIF downloads from GitHub Releases fail with {:header_too_long, {:max, 10240}} #114

Closed

Description

@themiguelamador

Since around 2026-10-22, every cold download of a precompiled NIF from GitHub Releases fails — anywhere the artifact isn't already in the cache (fresh CI caches, Docker image builds, new dev machines):

** (RuntimeError) Error while downloading precompiled NIF: couldn't fetch NIF from
https://github.com/leandrocp/mdex_native/releases/download/v0.2.7/libmdex_native_nif-v0.2.7-nif-2.15-x86_64-unknown-linux-gnu.so.tar.gz:
{:error, {:header_too_long, {:max, 10240}}}.

Cause

GitHub's 302 for release downloads now carries a large content-security-policy header (~9.2 KB), so the response headers exceed :httpc's default max_header_size of 10,240 bytes. RustlerPrecompiled passes only [body_format: :binary] as request options (also in 0.10.0 and main), so users can't raise the limit. The internal retries hit the same response every time.

First-hop response header sizes, measured 2026-10-24 with curl -sS -o /dev/null -D - <url> | wc -c:

Release asset Header bytes
mdex_native v0.2.7 x86_64-unknown-linux-gnu 10,880
y_ex v0.11.0 nif-2.15 x86_64-unknown-linux-gnu 10,859
tailwindcss CLI v3.4.10 linux-x64 (same failure in phoenixframework/tailwind) 10,783

The redirect target itself is small (~900 bytes); only the first hop is over the limit.

Reproduce

Elixir 1.20.4 / OTP 29.1.1, rustler_precompiled 0.9.0, a project depending on mdex_native 0.2.7 or y_ex 0.11.0:

RUSTLER_PRECOMPILED_GLOBAL_CACHE_PATH=$(mktemp -d) mix deps.compile rustler_precompiled mdex_native y_ex

Fix

#113 (max_header_size: 65_536 in the :httpc request options) fixes it. I applied that one line to 0.9.0 locally and re-ran the cold compile above: both NIFs downloaded from GitHub Releases and compiled, no header_too_long. #113 is approved with green CI. phoenixframework/tailwind shipped the same change in 0.5.2 (32_768).

Would a patch release with #113 be possible? Until then every package that fetches its NIF from GitHub Releases fails on a cold cache.

Workarounds in the meantime

  • Package mirror, where one exists: config :mdex_native, artifact_source: :cloudflare. The checksum file shipped in the hex package still verifies the artifact.
  • Build from source (needs a Rust toolchain): config :rustler_precompiled, :force_build, y_ex: true, using the dependency's otp_app.
  • Pre-download with curl into RUSTLER_PRECOMPILED_GLOBAL_CACHE_PATH. The checksum is still verified on load.

Activity

  1. philss commented on Oct 24, 2026

    @philss
    Owner

    This was fixed in v0.10.1, so I'm closing it. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions