{"record":{"id":"ef0afd48d3d06d35","repo":"larksuite/cli","slug":"pnpm-install-timed-out-after-s","errorCode":null,"errorMessage":"pnpm install timed out after %s","messagePattern":"pnpm install timed out after (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/selfupdate/updater.go","lineNumber":276,"sourceCode":"// RunPnpmInstall executes pnpm add -g @larksuite/cli@<version>.\nfunc (u *Updater) RunPnpmInstall(version string) *NpmResult {\n\tif u.PnpmInstallOverride != nil {\n\t\treturn u.PnpmInstallOverride(version)\n\t}\n\tr := &NpmResult{}\n\tpnpmPath, err := exec.LookPath(\"pnpm\")\n\tif err != nil {\n\t\tr.Err = fmt.Errorf(\"pnpm not found in PATH: %w\", err)\n\t\treturn r\n\t}\n\tctx, cancel := context.WithTimeout(context.Background(), npmInstallTimeout)\n\tdefer cancel()\n\tcmd := exec.CommandContext(ctx, pnpmPath, \"add\", \"-g\", NpmPackage+\"@\"+version)\n\tcmd.Stdout = &r.Stdout\n\tcmd.Stderr = &r.Stderr\n\tr.Err = cmd.Run()\n\tif ctx.Err() == context.DeadlineExceeded {\n\t\tr.Err = fmt.Errorf(\"pnpm install timed out after %s\", npmInstallTimeout)\n\t}\n\treturn r\n}\n\nfunc (u *Updater) FetchSkillsIndex(source string) *NpmResult {\n\tif u.SkillsIndexFetchOverride != nil {\n\t\treturn u.SkillsIndexFetchOverride()\n\t}\n\n\tr := &NpmResult{}\n\tctx, cancel := context.WithTimeout(context.Background(), skillsIndexFetchTimeout)\n\tdefer cancel()\n\n\treq, err := http.NewRequestWithContext(ctx, http.MethodGet, skillsIndexURL(source), nil)\n\tif err != nil {\n\t\tr.Err = err\n\t\treturn r\n\t}","sourceCodeStart":258,"sourceCodeEnd":294,"githubUrl":"https://github.com/larksuite/cli/blob/7fd6ef3c07182257ce776cdc5a614e122d5bd4b3/internal/selfupdate/updater.go#L258-L294","documentation":"RunPnpmInstall runs `pnpm add -g @larksuite/cli@<version>` under a context bounded by npmInstallTimeout. When the command exceeds the deadline, the context is canceled and this error replaces the underlying exec error to explain the timeout.","triggerScenarios":"Calling Updater.RunPnpmInstall(version) during a self-update when the spawned `pnpm add -g` process runs longer than npmInstallTimeout, i.e. ctx.Err() == context.DeadlineExceeded after cmd.Run().","commonSituations":"Slow network to the npm registry through pnpm's configured store/mirror; cold pnpm store requiring full download; low-resources VM or CI runner; proxy latency; very large install graph triggered by global store misses.","solutions":["Check connectivity and pnpm registry configuration (`pnpm config get registry`), then retry the update","Warm or clean the pnpm store (`pnpm store prune`) and retry","Use a faster registry mirror via `pnpm config set registry <mirror>`","Install manually outside the timeout: `pnpm add -g @larksuite/cli@latest`"],"exampleFix":"// before\nres := updater.RunPnpmInstall(\"1.2.3\")\nif res.Err != nil { log.Fatal(res.Err) }\n// after\nres := updater.RunPnpmInstall(\"1.2.3\")\nif res.Err != nil {\n\tif strings.Contains(res.Err.Error(), \"timed out\") {\n\t\t// do the install outside the CLI's bounded timeout\n\t\terr := exec.Command(\"pnpm\", \"add\", \"-g\", \"@larksuite/cli@latest\").Run()\n\t\tif err != nil { log.Fatal(err) }\n\t} else {\n\t\tlog.Fatal(res.Err)\n\t}\n}","handlingStrategy":"try-catch","validationCode":"if _, err := exec.LookPath(\"pnpm\"); err != nil { return }\nout, err := exec.Command(\"pnpm\", \"config\", \"get\", \"registry\").Output() // confirm a reachable registry","typeGuard":null,"tryCatchPattern":"res := updater.RunPnpmInstall(version)\nif res.Err != nil {\n\tif strings.Contains(res.Err.Error(), \"timed out after\") {\n\t\t// handle timeout: manual `pnpm add -g` fallback\n\t} else {\n\t\treturn res.Err\n\t}\n}","preventionTips":["Warm the pnpm store before updates on cold environments","Configure a nearby registry mirror if the default is slow","Avoid running updates over flaky networks/VPN","Note the shared npmInstallTimeout applies to pnpm too; use manual install for slow environments"],"tags":["pnpm","timeout","selfupdate","network"],"backgroundTag":"process-execution-timeout","analyzedSha":"7fd6ef3c07182257ce776cdc5a614e122d5bd4b3","analyzedAt":"2026-09-04T21:17:44.649Z","contentChangedAt":"2026-09-04T21:17:44.649Z","schemaVersion":2},"datasetVersion":"2026-09-12T02:17:10.037Z"}