{"record":{"id":"fb1357cc044c7edc","repo":"vllm-project/vllm","slug":"either-vllm-config-must-be-provided-or-all-of-mod","errorCode":null,"errorMessage":"Either vllm_config must be provided, or all of model_config, parallel_config, and cache_config must be provided.","messagePattern":"Either vllm_config must be provided, or all of model_config, parallel_config, and cache_config must be provided\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"vllm/distributed/kv_transfer/kv_connector/v1/lmcache_integration/utils.py","lineNumber":134,"sourceCode":"                                          to vllm_config)\n        cache_config (CacheConfig): Cache configuration (alternative to\n                                    vllm_config)\n    \"\"\"\n    # Third Party\n    # First Party\n    from lmcache.config import LMCacheEngineMetadata\n\n    from vllm.utils.torch_utils import get_kv_cache_torch_dtype\n\n    config = lmcache_get_or_create_config()\n    # Support both vllm_config object and individual config parameters\n    if vllm_config is not None:\n        model_cfg = vllm_config.model_config\n        parallel_cfg = vllm_config.parallel_config\n        cache_cfg = vllm_config.cache_config\n    else:\n        if model_config is None or parallel_config is None or cache_config is None:\n            raise ValueError(\n                \"Either vllm_config must be provided, or all of \"\n                \"model_config, parallel_config, and cache_config must be provided.\"\n            )\n        model_cfg = model_config\n        parallel_cfg = parallel_config\n        cache_cfg = cache_config\n\n    # Get KV cache dtype\n    kv_dtype = get_kv_cache_torch_dtype(cache_cfg.cache_dtype, model_cfg.dtype)\n\n    # Check if MLA is enabled\n    use_mla = mla_enabled(model_cfg)\n\n    # Construct KV shape (for memory pool)\n    num_layer = model_cfg.get_num_layers(parallel_cfg)\n    chunk_size = config.chunk_size\n    num_kv_head = model_cfg.get_num_kv_heads(parallel_cfg)\n    head_size = model_cfg.get_head_size()","sourceCodeStart":116,"sourceCodeEnd":152,"githubUrl":"https://github.com/vllm-project/vllm/blob/c794754062d49a8fdb63ab3c5215b488b865030c/vllm/distributed/kv_transfer/kv_connector/v1/lmcache_integration/utils.py#L116-L152","documentation":"ValueError from lmcache_get_or_create_engine_metadata-style config assembly in vLLM's LMCache integration utils: the caller passed neither a full vllm_config nor the complete trio of model_config, parallel_config, and cache_config. The function needs all three configs to build LMCacheEngineMetadata (KV dtype, MLA detection, parallelism), so it refuses partial input rather than guessing. It is an API-contract error, almost always a programming mistake in caller code, not a runtime/environment failure.","triggerScenarios":"Calling the metadata/config helper with vllm_config=None and one of model_config/parallel_config/cache_config also None; passing only model_config; constructing the adapter manually in tests without a full VllmConfig.","commonSituations":"Custom scripts or tests that instantiate the LMCache integration directly instead of going through the engine; refactors that changed a function signature from three configs to a single vllm_config and callers were not all updated.","solutions":["Pass the complete VllmConfig object — the preferred and simplest path.","If you must pass individual configs, supply all three: model_config, parallel_config, and cache_config.","In tests, build a minimal VllmConfig via the standard mock/vllm_config factory instead of hand-assembling configs."],"exampleFix":"# before\nmeta = build_metadata(model_config=mc)\n# after\nmeta = build_metadata(vllm_config=vllm_config)","handlingStrategy":"type-guard","validationCode":"from vllm.config import VllmConfig\nassert isinstance(vllm_config, VllmConfig) or all(\n    c is not None for c in (model_config, parallel_config, cache_config)\n)","typeGuard":"def has_full_config(vllm_config, model_config, parallel_config, cache_config) -> bool:\n    return vllm_config is not None or (\n        model_config is not None\n        and parallel_config is not None\n        and cache_config is not None\n    )","tryCatchPattern":null,"preventionTips":["Prefer passing the single vllm_config everywhere","Keep function signatures in sync with upstream when refactoring config plumbing"],"tags":["lmcache","config","api-misuse","kv-transfer"],"backgroundTag":null,"analyzedSha":"c794754062d49a8fdb63ab3c5215b488b865030c","analyzedAt":"2026-08-14T21:17:39.825Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}