hashicorp/packer · error
transformReleasesVersionStream got nil body
Error message
transformReleasesVersionStream got nil body
What it means
transformReleasesVersionStream in packer/plugin-getter/release/getter.go requires a non-nil HTTP response body (the GitHub tags stream) to decode. If the getter hands it a nil body, it returns this error instead of panicking on a nil reader. Indicates the upstream fetch produced no response body.
Source
Thrown at packer/plugin-getter/release/getter.go:47
var _ plugingetter.Getter = &Getter{}
func transformZipStream() func(in io.ReadCloser) (io.ReadCloser, error) {
return func(in io.ReadCloser) (io.ReadCloser, error) {
defer in.Close()
buf := new(bytes.Buffer)
_, err := io.Copy(buf, in)
if err != nil {
panic(err)
}
return io.NopCloser(buf), nil
}
}
// transformReleasesVersionStream get a stream from github tags and transforms it into
// something Packer wants, namely a json list of Release.
func transformReleasesVersionStream(in io.ReadCloser) (io.ReadCloser, error) {
if in == nil {
return nil, fmt.Errorf("transformReleasesVersionStream got nil body")
}
defer in.Close()
dec := json.NewDecoder(in)
var m gh.PluginMetadata
if err := dec.Decode(&m); err != nil {
return nil, err
}
var out []plugingetter.Release
for _, m := range m.Versions {
out = append(out, plugingetter.Release{
Version: "v" + m.Version,
})
}
buf := &bytes.Buffer{}
if err := json.NewEncoder(buf).Encode(out); err != nil {View on GitHub (pinned to eb36e3c3e4)
Solutions
- Check connectivity to github.com (curl https://github.com/<org>/<repo>/tags) and fix proxy/firewall access
- Re-run `packer init` — transient network failures can produce empty responses
- Inspect the plugin source identifier; a wrong host/namespace can hit an endpoint with no body
- Configure proper HTTPS_PROXY settings in restricted environments
- If reproducible with a valid identifier, file a bug with PACKER_LOG output
Example fix
// before $ packer init . Error: transformReleasesVersionStream got nil body // after (behind corporate proxy) export HTTPS_PROXY=http://proxy.corp:3128 packer init .
Defensive patterns
Strategy: retry
Validate before calling
// verify the release listing endpoint returns a body before init curl -fsSL https://github.com/<org>/<plugin>/releases -o /dev/null && \ echo "github reachable" || echo "fix proxy/network first"
Type guard
// Go-side guard used by the library itself
if in == nil {
return nil, fmt.Errorf("transformReleasesVersionStream got nil body")
} Try / catch
for attempt := 0; attempt < 3; attempt++ {
if err := run("packer", "init", "."); err == nil {
break
}
time.Sleep(2 * time.Second)
} Prevention
- Ensure stable github.com access (proxy env vars, firewall allowlist) before packer init
- Retry on transient network failures — empty bodies are often transient
- Double-check plugin source identifiers so requests hit real repositories
- Enable PACKER_LOG=1 to capture the request context when this occurs
When it happens
Trigger: The release getter passes a nil io.ReadCloser to transformReleasesVersionStream — e.g. an HTTP response with a nil Body from a failed or degenerate listing request to github.com tags.
Common situations: Network failure or blocked github.com access returning an empty/nil body; a mocked or misconfigured getter in tests; proxy returning an empty response for the plugin's tags listing during `packer init`.
Related errors
- could not find a local nor a remote checksum for plugin %q %
- could not parse release: %w
- could not write final plugin binary file: %w
- failed to checksum binary file: %s
- failed to write local binary checksum file: %s
AI-assisted analysis of hashicorp/packer@eb36e3c3e4 (2026-09-05).
Data as JSON: /api/errors/856671e03077258d.
Report an issue: GitHub.