router-for-me/CLIProxyAPI · error

plugin sync item %d auth %d: %w

Error message

plugin sync item %d auth %d: %w

What it means

Inside item N, one of the pre-resolved auth entries (ResolvedAuthConfig) failed ValidateResolvedAuthConfig, wrapped with both the item index and auth index. Sync-delivered auth must already be fully resolved and valid — a malformed entry aborts the whole response.

Source

Thrown at internal/pluginstore/home_sync.go:76

		return fmt.Errorf("plugin sync response expired")
	}
	seen := make(map[string]struct{}, len(r.Items))
	for index := range r.Items {
		item := &r.Items[index]
		if errManifest := item.Manifest.Validate(); errManifest != nil {
			return fmt.Errorf("plugin sync item %d: %w", index, errManifest)
		}
		if errURLs := validatePluginSyncManifestURLs(item.Manifest); errURLs != nil {
			return fmt.Errorf("plugin sync item %d: %w", index, errURLs)
		}
		id := strings.TrimSpace(item.Manifest.ID)
		if _, exists := seen[id]; exists {
			return fmt.Errorf("plugin sync response contains duplicate plugin %q", id)
		}
		seen[id] = struct{}{}
		for authIndex := range item.Auth {
			if errAuth := ValidateResolvedAuthConfig(item.Auth[authIndex]); errAuth != nil {
				return fmt.Errorf("plugin sync item %d auth %d: %w", index, authIndex, errAuth)
			}
		}
	}
	return nil
}

func validatePluginSyncManifestURLs(manifest Manifest) error {
	if manifest.InstallType() != InstallTypeDirect {
		return nil
	}
	plan := NormalizeInstallPlan(manifest.Install)
	if len(plan.Artifacts) == 0 {
		return fmt.Errorf("direct plugin sync manifest requires pinned artifacts")
	}
	for index, artifact := range plan.Artifacts {
		parsed, errParse := url.Parse(strings.TrimSpace(artifact.URL))
		if errParse != nil || !strings.EqualFold(parsed.Scheme, "https") {
			return fmt.Errorf("direct plugin sync artifact %d must use https", index)

View on GitHub (pinned to 78f0c4079e)

Solutions

  1. Inspect the wrapped error to see which auth field is invalid
  2. Fix or remove the auth entry at item N, auth K in the sync index
  3. Re-fetch the index after the server corrects the payload
Defensive patterns

Strategy: validation

Validate before calling

for i := range resp.Items {
    for k := range resp.Items[i].Auth {
        if err := pluginstore.ValidateResolvedAuthConfig(resp.Items[i].Auth[k]); err != nil {
            return fmt.Errorf("item %d auth %d invalid: %w", i, k, err)
        }
    }
}

Try / catch

if err != nil && strings.Contains(err.Error(), " auth ") {
    // identify item/auth indexes from the message; drop or fix that auth entry
}

Prevention

When it happens

Trigger: Validate on a sync response where item N's auth array entry K has an invalid resolved value — unsupported auth type, missing token/secret fields, empty values.

Common situations: Server bug emitting partially-resolved auth; auth scheme change not reflected in the index; an entry intended for a different plugin type.

Related errors


AI-assisted analysis of router-for-me/CLIProxyAPI@78f0c4079e (2026-08-15). Data as JSON: /api/errors/37d48c27f9aa1412. Report an issue: GitHub.