larksuite/cli · error

archive install failed: %s

Error message

archive install failed: %s

What it means

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.

Source

Thrown at internal/skillscheck/sync.go:429

	}
	names := []string{}
	for _, entry := range entries {
		if entry.IsDir() {
			names = append(names, entry.Name())
		}
	}
	sort.Strings(names)
	return names, nil
}

func syncLayout(runner SkillsRunner, source string, layout Layout, plan SyncPlan, installed []installedSkill) error {
	if layout == LayoutSuite {
		return syncSuite(runner, source, plan, installed)
	}
	if len(plan.ToUpdate) > 0 {
		result := runner.InstallSkills(source, plan.ToUpdate)
		if result == nil || result.Err != nil {
			return fmt.Errorf("archive install failed: %s", resultDetail(result))
		}
	}
	if hasInstalledSkill(installed, "lark-suite") {
		if result := runner.RemoveGlobalSkills([]string{"lark-suite"}); result == nil || result.Err != nil {
			return fmt.Errorf("remove lark-suite failed: %s", resultDetail(result))
		}
	}
	return nil
}

func fallbackSeparate(opts SyncOptions, previous *SkillsState, readable bool, local []string, installed []installedSkill, plan *SyncPlan, reasons []string) *SyncResult {
	if plan == nil && readable && previous != nil && len(previous.OfficialSkills) > 0 {
		fallback := PlanSync(SyncInput{
			Version:        opts.Version,
			OfficialSkills: previous.OfficialSkills,
			LocalSkills:    local,
			PreviousState:  previous,
			StateReadable:  true,

View on GitHub (pinned to 7fd6ef3c07)

Solutions

  1. Read the %s detail in the message (npm stdout/stderr) and fix the underlying install failure (auth, proxy, disk, missing package).
  2. Verify network access to the skills source and npm registry; retry after connectivity is restored.
  3. Confirm npm/node are installed and the global prefix is writable (`npm prefix -g`, `npm ping`).
  4. Clear the sync state or run with force so the plan recomputes and retries only missing skills.
  5. If the archive source is deprecated, switch to the suite layout install path.

Example fix

// before: install result carries the subprocess error
result := runner.InstallSkills(source, plan.ToUpdate) // result.Err = "npm ERR! 404 not found"
// after: check package availability/source before installing
if !registryHasPackages(source, plan.ToUpdate) {
    return fmt.Errorf("packages missing from %s; refresh index first", source)
}
result := runner.InstallSkills(source, plan.ToUpdate)
Defensive patterns

Strategy: try-catch

Validate before calling

// before sync: verify registry reachability and plan validity
if err := exec.Command("npm", "ping").Run(); err != nil {
    return fmt.Errorf("npm registry unreachable: %w", err)
}
for _, skill := range plan.ToUpdate {
    if !indexContains(official, skill) {
        return fmt.Errorf("skill %q not in index", skill)
    }
}

Type guard

func installOK(r *selfupdate.NpmResult) bool { return r != nil && r.Err == nil }

Try / catch

if err := syncLayout(runner, source, layout, plan, installed); err != nil {
    if strings.Contains(err.Error(), "archive install failed:") {
        detail := strings.TrimPrefix(err.Error(), "archive install failed: ")
        // inspect npm stdout/stderr in detail; retry after fixing npm/network
        _ = detail
    }
    return err
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of larksuite/cli@7fd6ef3c07 (2026-09-04). Data as JSON: /api/errors/2756ad7ea2d96429. Report an issue: GitHub.