{"record":{"id":"d9a013ffa3ada9cd","repo":"sgl-project/sglang","slug":"e-d9a013","errorCode":null,"errorMessage":"{e}","messagePattern":"\\{e\\}","errorType":"http","errorClass":"HTTPException","httpStatus":400,"severity":"warning","filePath":"python/sglang/srt/entrypoints/v1_loads.py","lineNumber":126,"sourceCode":"        include: Comma-separated sections to include (optional)\n                 Options: core, memory, spec, lora, disagg, queues, all\n                 Default: all\n        format: Response format - 'json' (default) or 'prometheus'\n\n    Returns:\n        JSON response with timestamp, version, accelerator metadata, and\n        per-DP-rank loads\n    \"\"\"\n    include_list = [s.strip() for s in include.split(\",\")] if include else None\n\n    start = time.perf_counter()\n    try:\n        load_results = await tokenizer_manager.get_loads(\n            include=include_list,\n            dp_rank=dp_rank,\n        )\n    except ValueError as e:\n        raise HTTPException(status_code=400, detail=str(e))\n    finally:\n        mc = getattr(tokenizer_manager, \"metrics_collector\", None)\n        if mc is not None:\n            mc.get_loads_duration_seconds.labels(**mc.labels).observe(\n                time.perf_counter() - start\n            )\n\n    include_set = set(include_list) if include_list else None\n\n    if format == \"prometheus\":\n        return _format_loads_prometheus(load_results, include_set)\n\n    loads = []\n    for load in load_results:\n        d = load.to_dict(include_set)\n        loads.append(d)\n\n    return {","sourceCodeStart":108,"sourceCodeEnd":144,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/entrypoints/v1_loads.py#L108-L144","documentation":"SGLang's /v1/loads endpoint wraps ValueError from tokenizer_manager.get_loads() into an HTTP 400 with the original message as detail. The underlying ValueError typically signals an invalid include filter or an invalid dp_rank for the data-parallel topology.","triggerScenarios":"GET /v1/load with include=... containing unknown keys, or dp_rank greater than/equal to the server's DP size (or negative), causing get_loads to raise ValueError, which is rethrown as HTTPException(400, str(e)).","commonSituations":"Client passing an unsupported metrics include list, guessing dp_rank after changing --dp-size, or stale client code after the include enum changed between SGLang versions.","solutions":["Read the response detail — it is the raw ValueError text naming the invalid parameter","Use include values from the documented enum and dp_rank in [0, dp_size-1]","Omit dp_rank to query the aggregated load across DP ranks"],"exampleFix":"# before\nresp = requests.get(f\"{base}/v1/loads\", params={\"include\": \"bogus\", \"dp_rank\": 8})\n# after\nresp = requests.get(f\"{base}/v1/loads\", params={\"include\": \"queue\", \"dp_rank\": 0})","handlingStrategy":"try-catch","validationCode":"# validate before calling the API\nvalid_include = {\"queue\", \"cache\", \"generation\"}  # per server docs\nparams = {\"include\": \"queue\", \"dp_rank\": 0}\nassert set(params.get(\"include\", \"\").split(\",\")) <= valid_include","typeGuard":null,"tryCatchPattern":"try:\n    loads = await client.get_loads(include=include, dp_rank=dp_rank)\nexcept HTTPException as e:  # or requests.HTTPError\n    if e.response.status_code == 400:\n        detail = e.response.json()[\"detail\"]  # original ValueError message\n        fix_params_from(detail)\n    raise","preventionTips":["Fetch dp_size from /get_server_info and clamp dp_rank accordingly","Treat any 400 detail as authoritative parameter feedback and log it"],"tags":["http","loads","bad-request","metrics","sglang"],"backgroundTag":"invalid-query-parameter","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}