litellm - ✅(Solved) Fix Cache health check returns None for host and port despite working Redis connection [1 pull requests, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
BerriAI/litellm#24636Fetched 2026-04-08 01:37:29
View on GitHub
Comments
0
Participants
1
Timeline
2
Reactions
0
Participants
Timeline (top)
cross-referenced ×1referenced ×1

Fix Action

Fixed

PR fix notes

PR #24638: fix: use redis_kwargs host/port in cache ping health check (#24636)

Description (problem / solution / changelog)

Fixes #24636. The /cache/ping endpoint was returning None for host and port because it didn't fall back to the settings configured in redis_kwargs. This ensures the actual Redis host/port are displayed in the Admin UI.\n\n*(Refactored using the open-source 0-editor)*\n\n

Changed files

  • litellm/proxy/caching_routes.py (modified, +5/-0)

Code Example

{
  "status": "healthy",
  "cache_type": "redis",
  "ping_response": true,
  "set_cache_response": "success",
  "health_check_cache_params": {
    "host": "None",
    "port": "None",
    "redis_kwargs": {
      "host": "redis",
      "port": 6379,
      "socket_timeout": 5.0
    },
    "namespace": "None",
    "redis_version": "7.4.8"
  }
}

---

litellm_settings:
  cache: true
  cache_params:
    type: redis
    host: redis
    port: 6379

---

REDIS_HOST=redis
REDIS_PORT=6379
RAW_BUFFERClick to expand / collapse

Bug Description

The /cache/ping endpoint returns "None" for host and port in the top-level health_check_cache_params, even though the Redis connection is fully operational and the correct values are present in the nested redis_kwargs.

This causes the LiteLLM Admin UI (/#/caching) to not display the Redis host and port, making it look like the cache is misconfigured when it's actually working fine.

Response from /cache/ping

{
  "status": "healthy",
  "cache_type": "redis",
  "ping_response": true,
  "set_cache_response": "success",
  "health_check_cache_params": {
    "host": "None",
    "port": "None",
    "redis_kwargs": {
      "host": "redis",
      "port": 6379,
      "socket_timeout": 5.0
    },
    "namespace": "None",
    "redis_version": "7.4.8"
  }
}

Expected Behavior

host and port in health_check_cache_params should reflect the actual connected Redis host and port (i.e., "redis" and 6379), matching what's in redis_kwargs. The UI should display these values.

Actual Behavior

  • host and port are "None" at the top level
  • The real values only appear inside redis_kwargs
  • The Admin UI caching page shows blank/empty host and port fields

Configuration

litellm_settings:
  cache: true
  cache_params:
    type: redis
    host: redis
    port: 6379

Environment variables also set:

REDIS_HOST=redis
REDIS_PORT=6379

Environment

  • LiteLLM image: ghcr.io/berriai/litellm:main-stable
  • Redis: redis:7-alpine (v7.4.8)
  • Running as Docker Compose services (Docker Desktop Extension)

Impact

Cosmetic/UX — cache works correctly, but the UI doesn't show connection details, which is confusing when verifying configuration.

extent analysis

Fix Plan

To fix the issue, we need to update the /cache/ping endpoint to correctly populate the host and port fields in health_check_cache_params.

  • Update the code that handles the /cache/ping endpoint to use the values from redis_kwargs for host and port when they are "None" at the top level.
  • Example code snippet:
def handle_cache_ping():
    # ... existing code ...
    health_check_cache_params = {
        "host": redis_kwargs.get("host") or health_check_cache_params.get("host"),
        "port": redis_kwargs.get("port") or health_check_cache_params.get("port"),
        "redis_kwargs": redis_kwargs,
        # ... other fields ...
    }
    return {
        "status": "healthy",
        "cache_type": "redis",
        "ping_response": True,
        "set_cache_response": "success",
        "health_check_cache_params": health_check_cache_params
    }

Verification

To verify the fix, make a request to the /cache/ping endpoint and check that the response contains the correct host and port values in health_check_cache_params. The LiteLLM Admin UI should now display the Redis host and port correctly.

Extra Tips

  • Ensure that the redis_kwargs dictionary is correctly populated with the Redis connection details.
  • If using environment variables, verify that they are correctly set and accessible in the application.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING