{"record":{"id":"4e53bc343c281b95","repo":"serverless/serverless","slug":"panic-err-downloadframeworkversion-failure","errorCode":null,"errorMessage":"panic(err) — downloadFrameworkVersion failure","messagePattern":"panic\\(err\\) — downloadFrameworkVersion failure","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"binary-installer/src/version.go","lineNumber":299,"sourceCode":"\t\t\tfmt.Fprintf(os.Stderr, \"No version found for %s\\n\", version)\n\t\t\tos.Exit(1)\n\t\t}\n\t\tshouldPrintAutoUpdateWarning = matchedVersion.shouldPrintAutoUpdateWarning\n\t\treleaseRecord = &ReleaseRecord{\n\t\t\tVersion:       FrameworkVersion(matchedVersion.matchedVersion),\n\t\t\tReleaseDate:   time.Now().Format(time.RFC3339),\n\t\t\tDownloadUrl:   fmt.Sprintf(\"https://install.serverless.com/archives/serverless-%s.tgz\", matchedVersion.matchedVersion),\n\t\t\tLatestVersion: FrameworkVersion(matchedVersion.matchedVersion),\n\t\t}\n\t}\n\n\treleasePath, err := downloadFrameworkVersion(releaseRecord, shouldCheckForUpdates, shouldPrintAutoUpdateWarning)\n\tif err != nil {\n\t\tif errors.Is(err, context.Canceled) {\n\t\t\tfmt.Fprintf(os.Stderr, \"Installation interrupted\\n\")\n\t\t\tos.Exit(130)\n\t\t}\n\t\tpanic(err)\n\t}\n\treturn &FrameworkRelease{\n\t\tVersion:       releaseRecord.Version,\n\t\tReleasePath:   releasePath,\n\t\tLatestVersion: &releaseRecord.LatestVersion,\n\t}, nil\n}\n\nfunc findClosestMatch(versions []string, constraint string) (string, error) {\n\t// Parse the constraint\n\tc, err := semver.NewConstraint(constraint)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"invalid constraint: %w\", err)\n\t}\n\n\t// Parse and sort the versions\n\tvar semvers semver.Collection\n\tfor _, v := range versions {","sourceCodeStart":281,"sourceCodeEnd":317,"githubUrl":"https://github.com/serverless/serverless/blob/b9d7ea51c8cce57cff1207964b9b71123673081f/binary-installer/src/version.go#L281-L317","documentation":"In the outer EnsureFrameworkVersion path, downloadFrameworkVersion returned a non-nil error that is NOT context.Canceled (cancellation is handled with a clean exit 130 message just above). The code panics, aborting the launcher with a stack trace. The underlying error is whatever downloadFrameworkVersion produced — most often one of errors 600–606 (extraction/package.json), a network failure from the HTTP fetch, or a `resolving home dir` error from os.UserHomeDir at the top of that function.","triggerScenarios":"Triggered after downloadFrameworkVersion fails for any reason other than user-initiated cancellation: network error fetching the .tgz from install.serverless.com, gzip/tar read error, any of the extraction errors (600/601/602), archiveHasDependencies failure (603/605/606), or npm install failure (604). Because the caller does not retry, a transient network blip becomes a hard panic.","commonSituations":"Flaky networks where the .tgz download fails partway; corporate proxies blocking install.serverless.com; the underlying extraction/permission errors from 600–606 propagating up; first-time installs on misconfigured systems. The panic is user-visible and not actionable without re-running.","solutions":["Re-run the command — many triggers (network blips, transient proxy errors) clear on retry; the launcher resumes from where it can.","Clear any partial release before retrying: `rm -rf ~/.serverless/releases/<version>`.","Inspect the stderr above the panic for the wrapped error — it points to the real cause (network, disk, package.json).","Verify connectivity to install.serverless.com: `curl -I https://install.serverless.com/versions.json`.","If $HOME is unset, set it (see errors 608–614)."],"exampleFix":"// The panic wraps a real error printed just above it. Recover by clearing state and retrying:\nrm -rf ~/.serverless/releases/<version>\ncurl -fsSL https://install.serverless.com/versions.json | head   # confirm reachability\nserverless <command>","handlingStrategy":"retry","validationCode":"// Pre-flight before invoking serverless in automation:\nfunc installPreflight() error {\n  if err := homeReady(); err != nil { return err }            // see 608\n  resp, err := http.Head(\"https://install.serverless.com/versions.json\")\n  if err != nil || resp.StatusCode/100 != 2 {\n    return fmt.Errorf(\"install.serverless.com unreachable\")\n  }\n  return nil\n}","typeGuard":"null","tryCatchPattern":"null","preventionTips":["Re-run the install after a failure — many triggers are transient network blips.","Clear ~/.serverless/releases/<version> before retrying to avoid reusing a partial extract.","Ensure outbound HTTPS to install.serverless.com is allowed.","Set HOME (see 608–614) to rule out the resolve-home failure mode."],"tags":["go","binary-installer","download","network","panic","installer"],"backgroundTag":null,"analyzedSha":"b9d7ea51c8cce57cff1207964b9b71123673081f","analyzedAt":"2026-08-13T04:14:40.386Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}