larksuite/cli · error

index request failed: %s

Error message

index request failed: %s

What it means

fetchOfficialSkills wraps the result of Runner.FetchSkillsIndex(source). It returns this error when the runner returns nil or result.Err != nil, i.e. the HTTP/command request to fetch the skills index itself failed before any parsing. resultDetail(result) appends whatever diagnostic the runner captured (transport error, non-zero exit, empty stdout).

Source

Thrown at internal/skillscheck/sync.go:352

	}

	if targetLayout == LayoutSuite {
		return &SyncResult{
			Action: "failed",
			Layout: targetLayout,
			Err:    fmt.Errorf("suite skills sync failed: %s", strings.Join(reasons, "; ")),
			Detail: strings.Join(reasons, "\n"),
			Force:  opts.Force,
		}
	}

	return fallbackSeparate(opts, previous, readable, localOfficial, installed, fallbackPlan, reasons)
}

func fetchOfficialSkills(runner SkillsRunner, source string) ([]string, error) {
	result := runner.FetchSkillsIndex(source)
	if result == nil || result.Err != nil {
		return nil, fmt.Errorf("index request failed: %s", resultDetail(result))
	}
	official, err := ParseOfficialSkillsIndexJSON(result.Stdout.String())
	if err != nil {
		return nil, fmt.Errorf("invalid v0.2 index: %w", err)
	}
	if len(official) == 0 {
		return nil, fmt.Errorf("v0.2 index contains no skills")
	}
	return official, nil
}

func listInstalledSkills(runner SkillsRunner) ([]installedSkill, error) {
	jsonResult := runner.ListGlobalSkillsJSON()
	if jsonResult != nil && jsonResult.Err == nil {
		if installed, err := parseInstalledSkillsJSON(jsonResult.Stdout.String()); err == nil {
			return installed, nil
		}
	}

View on GitHub (pinned to 7fd6ef3c07)

Solutions

  1. Check network reachability of the skills index host (curl the source URL) and configure proxy env vars (HTTP_PROXY/HTTPS_PROXY) if needed
  2. Fix the source URL in the runner's SkillsSources() configuration
  3. Verify the underlying skills CLI/command used by FetchSkillsIndex is installed and runs (run it manually and check its stderr)
  4. Read the appended resultDetail text for the exact transport or command error
  5. Try the next source in SkillsSources(); if all fail, the sync aborts or falls back

Example fix

// debugging: reproduce the fetch manually
result := runner.FetchSkillsIndex(source)
if result == nil || result.Err != nil {
    log.Printf("index fetch failed for %s: %s", source, resultDetail(result))
    // check proxy / DNS / CLI availability before retrying
}
Defensive patterns

Strategy: retry

Validate before calling

resp, err := http.Get(sourceURL)
if err != nil || resp.StatusCode != http.StatusOK {
    return fmt.Errorf("index endpoint not reachable: %v/%d", err, statusCodeOf(resp))
}

Try / catch

official, err := fetchOfficialSkills(runner, source)
if err != nil && strings.HasPrefix(err.Error(), "index request failed") {
    // transient transport failure: back off and retry, then fall through to next source
    time.Sleep(backoff)
    official, err = fetchOfficialSkills(runner, source)
}

Prevention

When it happens

Trigger: SyncSkills -> fetchOfficialSkills where FetchSkillsIndex returns nil, or a result with Err set (network failure, command error, non-2xx response, missing output).

Common situations: Offline or behind a corporate proxy; DNS failure for the index host; TLS interception rejecting the certificate; the source URL misconfigured in SkillsSources(); the underlying CLI command the runner shells out to is not installed or fails.

Related errors


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