{"record":{"id":"856671e03077258d","repo":"hashicorp/packer","slug":"transformreleasesversionstream-got-nil-body","errorCode":null,"errorMessage":"transformReleasesVersionStream got nil body","messagePattern":"transformReleasesVersionStream got nil body","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packer/plugin-getter/release/getter.go","lineNumber":47,"sourceCode":"var _ plugingetter.Getter = &Getter{}\n\nfunc transformZipStream() func(in io.ReadCloser) (io.ReadCloser, error) {\n\treturn func(in io.ReadCloser) (io.ReadCloser, error) {\n\t\tdefer in.Close()\n\t\tbuf := new(bytes.Buffer)\n\t\t_, err := io.Copy(buf, in)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\treturn io.NopCloser(buf), nil\n\t}\n}\n\n// transformReleasesVersionStream get a stream from github tags and transforms it into\n// something Packer wants, namely a json list of Release.\nfunc transformReleasesVersionStream(in io.ReadCloser) (io.ReadCloser, error) {\n\tif in == nil {\n\t\treturn nil, fmt.Errorf(\"transformReleasesVersionStream got nil body\")\n\t}\n\tdefer in.Close()\n\tdec := json.NewDecoder(in)\n\n\tvar m gh.PluginMetadata\n\tif err := dec.Decode(&m); err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar out []plugingetter.Release\n\tfor _, m := range m.Versions {\n\t\tout = append(out, plugingetter.Release{\n\t\t\tVersion: \"v\" + m.Version,\n\t\t})\n\t}\n\n\tbuf := &bytes.Buffer{}\n\tif err := json.NewEncoder(buf).Encode(out); err != nil {","sourceCodeStart":29,"sourceCodeEnd":65,"githubUrl":"https://github.com/hashicorp/packer/blob/eb36e3c3e48a036f3e8cc94087636ee72e1303c9/packer/plugin-getter/release/getter.go#L29-L65","documentation":"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.","triggerScenarios":"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.","commonSituations":"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`.","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"],"exampleFix":"// before\n$ packer init .\nError: transformReleasesVersionStream got nil body\n// after (behind corporate proxy)\nexport HTTPS_PROXY=http://proxy.corp:3128\npacker init .","handlingStrategy":"retry","validationCode":"// verify the release listing endpoint returns a body before init\ncurl -fsSL https://github.com/<org>/<plugin>/releases -o /dev/null && \\\n  echo \"github reachable\" || echo \"fix proxy/network first\"","typeGuard":"// Go-side guard used by the library itself\nif in == nil {\n    return nil, fmt.Errorf(\"transformReleasesVersionStream got nil body\")\n}","tryCatchPattern":"for attempt := 0; attempt < 3; attempt++ {\n    if err := run(\"packer\", \"init\", \".\"); err == nil {\n        break\n    }\n    time.Sleep(2 * time.Second)\n}","preventionTips":["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"],"tags":["plugin-install","network","github-api","packer"],"backgroundTag":"empty-response-body","analyzedSha":"eb36e3c3e48a036f3e8cc94087636ee72e1303c9","analyzedAt":"2026-09-05T13:20:43.127Z","contentChangedAt":"2026-09-05T13:20:43.127Z","schemaVersion":2},"datasetVersion":"2026-09-12T17:17:11.597Z"}