{"record":{"id":"2756ad7ea2d96429","repo":"larksuite/cli","slug":"archive-install-failed-s","errorCode":null,"errorMessage":"archive install failed: %s","messagePattern":"archive install failed: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/skillscheck/sync.go","lineNumber":429,"sourceCode":"\t}\n\tnames := []string{}\n\tfor _, entry := range entries {\n\t\tif entry.IsDir() {\n\t\t\tnames = append(names, entry.Name())\n\t\t}\n\t}\n\tsort.Strings(names)\n\treturn names, nil\n}\n\nfunc syncLayout(runner SkillsRunner, source string, layout Layout, plan SyncPlan, installed []installedSkill) error {\n\tif layout == LayoutSuite {\n\t\treturn syncSuite(runner, source, plan, installed)\n\t}\n\tif len(plan.ToUpdate) > 0 {\n\t\tresult := runner.InstallSkills(source, plan.ToUpdate)\n\t\tif result == nil || result.Err != nil {\n\t\t\treturn fmt.Errorf(\"archive install failed: %s\", resultDetail(result))\n\t\t}\n\t}\n\tif hasInstalledSkill(installed, \"lark-suite\") {\n\t\tif result := runner.RemoveGlobalSkills([]string{\"lark-suite\"}); result == nil || result.Err != nil {\n\t\t\treturn fmt.Errorf(\"remove lark-suite failed: %s\", resultDetail(result))\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc fallbackSeparate(opts SyncOptions, previous *SkillsState, readable bool, local []string, installed []installedSkill, plan *SyncPlan, reasons []string) *SyncResult {\n\tif plan == nil && readable && previous != nil && len(previous.OfficialSkills) > 0 {\n\t\tfallback := PlanSync(SyncInput{\n\t\t\tVersion:        opts.Version,\n\t\t\tOfficialSkills: previous.OfficialSkills,\n\t\t\tLocalSkills:    local,\n\t\t\tPreviousState:  previous,\n\t\t\tStateReadable:  true,","sourceCodeStart":411,"sourceCodeEnd":447,"githubUrl":"https://github.com/larksuite/cli/blob/7fd6ef3c07182257ce776cdc5a614e122d5bd4b3/internal/skillscheck/sync.go#L411-L447","documentation":"syncLayout performs per-skill (archive/separate layout) installation via runner.InstallSkills for the skills marked ToUpdate in the sync plan. This error is returned when that call returns nil or carries a non-nil Err, meaning the npm-based archive install of one or more skills failed. resultDetail(result) appends the underlying CLI's output so the actual npm failure reason is preserved in the message.","triggerScenarios":"Calling SyncSkills against the archive layout when plan.ToUpdate is non-empty and runner.InstallSkills(source, plan.ToUpdate) fails — e.g. the npm registry request errors, the package is not found, the install subprocess exits non-zero, or the runner returns nil.","commonSituations":"Network outage or corporate proxy blocking registry access; the skills source is unreachable or its URL changed; npm is not installed or misconfigured; a package name/version in the plan no longer exists; disk or permission errors in the global prefix.","solutions":["Read the %s detail in the message (npm stdout/stderr) and fix the underlying install failure (auth, proxy, disk, missing package).","Verify network access to the skills source and npm registry; retry after connectivity is restored.","Confirm npm/node are installed and the global prefix is writable (`npm prefix -g`, `npm ping`).","Clear the sync state or run with force so the plan recomputes and retries only missing skills.","If the archive source is deprecated, switch to the suite layout install path."],"exampleFix":"// before: install result carries the subprocess error\nresult := runner.InstallSkills(source, plan.ToUpdate) // result.Err = \"npm ERR! 404 not found\"\n// after: check package availability/source before installing\nif !registryHasPackages(source, plan.ToUpdate) {\n    return fmt.Errorf(\"packages missing from %s; refresh index first\", source)\n}\nresult := runner.InstallSkills(source, plan.ToUpdate)","handlingStrategy":"try-catch","validationCode":"// before sync: verify registry reachability and plan validity\nif err := exec.Command(\"npm\", \"ping\").Run(); err != nil {\n    return fmt.Errorf(\"npm registry unreachable: %w\", err)\n}\nfor _, skill := range plan.ToUpdate {\n    if !indexContains(official, skill) {\n        return fmt.Errorf(\"skill %q not in index\", skill)\n    }\n}","typeGuard":"func installOK(r *selfupdate.NpmResult) bool { return r != nil && r.Err == nil }","tryCatchPattern":"if err := syncLayout(runner, source, layout, plan, installed); err != nil {\n    if strings.Contains(err.Error(), \"archive install failed:\") {\n        detail := strings.TrimPrefix(err.Error(), \"archive install failed: \")\n        // inspect npm stdout/stderr in detail; retry after fixing npm/network\n        _ = detail\n    }\n    return err\n}","preventionTips":["Keep npm/node on PATH and the global prefix writable.","Check registry/proxy connectivity before running sync in CI.","Pin the skills source URL to a maintained, existing location.","Recompute the plan (clear stale state) so ToUpdate only contains installable skills."],"tags":["npm","install-failed","skills-sync","network"],"backgroundTag":"npm-install-failed","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"}