vllm-project/vllm · error · HTTPException
Allocation failed: {str(e)}
Error message
Allocation failed: {str(e)} What it means
A catch-all around state.allocate_pages_for_keys on the metadata server: any exception during allocation (most commonly 'Rank {rank} not initialized', but also malformed key values or internal state errors) is re-raised as HTTP 500 'Allocation failed: <original message>'. The original exception is chained via 'from e' and appears in the detail string.
Source
Thrown at vllm/distributed/kv_transfer/kv_connector/v1/hf3fs/hf3fs_metadata_server.py:315
data = await self._read_json(request)
rank = data.get("rank")
keys = data.get("keys", [])
# Validate input format
if rank is None or not isinstance(keys, list):
raise HTTPException(
status_code=400, detail="Invalid request format: need 'rank' and 'keys'"
)
try:
# Perform allocation
results = self.state.allocate_pages_for_keys(rank, keys)
# Convert results to response format
response = {"rank": rank, "results": list(results.items())}
return self._json_response(response)
except Exception as e:
raise HTTPException(
status_code=500, detail=f"Allocation failed: {str(e)}"
) from e
async def confirm_write_for_keys(self, request: Request):
"""Confirm write operations for keys."""
data = await self._read_json(request)
rank = data.get("rank")
confirmations = data.get("confirmations", [])
pages_to_release = data.get("pages_to_release", [])
# Validate input format
if rank is None or not isinstance(confirmations, list):
raise HTTPException(
status_code=400,
detail="Invalid request format: need 'rank' and 'confirmations'",
)
try:View on GitHub (pinned to c794754062)
Solutions
- Read the detail string — it contains the root cause (e.g. 'Rank 3 not initialized' means: initialize first)
- Ensure /initialize for the rank succeeds before allocation requests
- Check metadata server logs for the chained traceback if the detail is unclear
Example fix
# before
resp = requests.post(url, json={'rank': 3, 'keys': keys}) # 500 Allocation failed: Rank 3 not initialized
# after
requests.post(url + '/initialize', json={'rank': 3, 'role': 'worker', 'num_pages': 1024})
resp = requests.post(url, json={'rank': 3, 'keys': keys})
resp.raise_for_status() Defensive patterns
Strategy: retry
Validate before calling
if rank not in state.rank_metadata:
requests.post(f'{server}/initialize',
json={'rank': rank, 'role': 'worker', 'num_pages': n_pages}) Try / catch
resp = requests.post(f'{server}/allocate', json={'rank': rank, 'keys': keys})
if resp.status_code == 500 and 'not initialized' in resp.text:
requests.post(f'{server}/initialize',
json={'rank': rank, 'role': 'worker', 'num_pages': n_pages})
resp = requests.post(f'{server}/allocate', json={'rank': rank, 'keys': keys})
resp.raise_for_status() Prevention
- Parse the 500 detail string — it carries the root cause
- Initialize ranks idempotently at worker startup to avoid the common cause
- Monitor metadata server logs for chained tracebacks
When it happens
Trigger: POST /allocate for a rank that was never initialized, or any server-side allocation error; the endpoint converts it to a 500 with the underlying message embedded.
Common situations: Allocation racing ahead of initialization; metadata server restarted losing rank_metadata; keys with unexpected types breaking allocation internals.
Related errors
- Rank {rank} not initialized
- Invalid initialization parameters
- Invalid request format: need 'rank' and 'keys'
- Confirmation failed: {str(e)}
- Key existence check failed: {str(e)}
AI-assisted analysis of vllm-project/vllm@c794754062 (2026-08-14).
Data as JSON: /api/errors/c3bb612f19fc7e3d.
Report an issue: GitHub.