router-for-me/CLIProxyAPI · error

auth runtime info not found for auth_index %s

Error message

auth runtime info not found for auth_index %s

What it means

authByIndex resolved the auth and the manager returned it, but buildHostAuthFileEntry produced nil for it — the auth exists in the manager yet cannot be mapped to a host auth file entry (e.g. missing file name, unreadable attributes, or an entry shape the builder rejects). The runtime-info call therefore cannot return data.

Source

Thrown at internal/pluginhost/auth_callbacks.go:111

}

func (h *Host) callHostAuthGetRuntime(ctx context.Context, request []byte) ([]byte, error) {
	_ = ctx
	var req rpcHostAuthGetRequest
	if errUnmarshal := json.Unmarshal(request, &req); errUnmarshal != nil {
		return nil, fmt.Errorf("decode host auth get runtime request: %w", errUnmarshal)
	}
	authIndex := strings.TrimSpace(req.AuthIndex)
	if authIndex == "" {
		return nil, fmt.Errorf("auth_index is required")
	}
	auth, errGet := h.authByIndex(authIndex)
	if errGet != nil {
		return nil, errGet
	}
	entry := h.buildHostAuthFileEntry(auth)
	if entry == nil {
		return nil, fmt.Errorf("auth runtime info not found for auth_index %s", authIndex)
	}
	return marshalRPCResult(pluginapi.HostAuthGetRuntimeResponse{Auth: *entry})
}

func (h *Host) callHostAuthSave(ctx context.Context, request []byte) ([]byte, error) {
	var req pluginapi.HostAuthSaveRequest
	if errUnmarshal := json.Unmarshal(request, &req); errUnmarshal != nil {
		return nil, fmt.Errorf("decode host auth save request: %w", errUnmarshal)
	}
	name, rawJSON, errValidate := validateHostAuthSaveRequest(req)
	if errValidate != nil {
		return nil, errValidate
	}
	path, errSave := h.saveAuthFile(ctx, name, rawJSON)
	if errSave != nil {
		return nil, errSave
	}
	return marshalRPCResult(pluginapi.HostAuthSaveResponse{

View on GitHub (pinned to 78f0c4079e)

Solutions

  1. Retry after re-listing auth files — if the index disappeared, re-acquire it from a fresh auth.list
  2. Inspect the auth record (file name, ID, attributes) in the auth store for the given index and repair or delete the malformed entry
  3. Re-run OAuth login for that provider to regenerate a complete auth file
  4. If it happens consistently after upgrade, clear the stale auth dir entry and let the host rebuild it
Defensive patterns

Strategy: retry

Try / catch

entry, err := hostClient.AuthGetRuntime(ctx, req)
if err != nil && strings.Contains(err.Error(), "auth runtime info not found") {
    files, listErr := hostClient.AuthList(ctx)
    if listErr == nil && len(files.Files) > 0 {
        req.AuthIndex = files.Files[0].AuthIndex
        entry, err = hostClient.AuthGetRuntime(ctx, req)
    }
}

Prevention

When it happens

Trigger: Calling auth get runtime for an auth whose in-memory record is incomplete — auth loaded partially, file name/ID missing after migration, or a transient state during hot-reload where the auth is listed but its file entry cannot be built.

Common situations: Auth store migrated between formats leaving partial records; auth file deleted on disk while still cached in the manager; plugin holding an auth_index across a reload that changed entry shape.

Related errors


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