{"record":{"id":"8a10bdaf9162d6a9","repo":"vllm-project/vllm","slug":"chat-template-looks-like-a-file-path-but-does-not","errorCode":null,"errorMessage":"chat template looks like a file path but does not exist","messagePattern":"chat template looks like a file path but does not exist","errorType":"exception","errorClass":"TemplateError","httpStatus":null,"severity":"error","filePath":"rust/src/chat/src/renderer/hf/error.rs","lineNumber":12,"sourceCode":"// SPDX-License-Identifier: Apache-2.0\n// SPDX-FileCopyrightText: Copyright contributors to the vLLM project\n\nuse thiserror::Error as ThisError;\n\n#[derive(Debug, ThisError)]\npub(crate) enum TemplateError {\n    #[error(\"failed to render jinja template\")]\n    Jinja(#[from] minijinja::Error),\n    #[error(\"failed to read chat template file\")]\n    ReadTemplateFile(#[source] std::io::Error),\n    #[error(\"chat template looks like a file path but does not exist\")]\n    MissingTemplatePath,\n    #[error(\"failed to parse chat_template.json\")]\n    ParseTemplateJson(#[source] serde_json::Error),\n    #[error(\"chat_template.json does not contain a valid template\")]\n    InvalidTemplateJson,\n}\n","sourceCodeStart":1,"sourceCodeEnd":19,"githubUrl":"https://github.com/vllm-project/vllm/blob/c794754062d49a8fdb63ab3c5215b488b865030c/rust/src/chat/src/renderer/hf/error.rs#L1-L19","documentation":"The configured chat-template value looks like a file path (heuristic in `renderer/hf/template.rs`), but no file exists at that path; template resolution ends with `Err(TemplateError::MissingTemplatePath)` at line 96. It means the renderer refused to fall back to treating the string as inline template text because it is path-shaped.","triggerScenarios":"`--chat-template ./templates/custom.jinja` where the file is missing relative to the server's working directory; absolute path typos; template file not shipped into the container image.","commonSituations":"Relative paths resolved against a different CWD inside Docker; CI/deploy omitting the template file from the artifact; host path not bind-mounted into the container.","solutions":["Verify the file exists at the exact path the server resolves (check container CWD; use absolute paths).","If the value was meant to be an inline template string, make sure it does not look like a path (contains no `/` and is not a lone filename) — or put it in a file instead.","Add the template file to the Docker image / Kubernetes ConfigMap volume and re-run."],"exampleFix":"# before\nvllm serve model --chat-template ./custom.jinja # file not in container\n\n# after\nvllm serve model --chat-template /configs/custom.jinja # mounted at known absolute path","handlingStrategy":"validation","validationCode":"let p = std::path::PathBuf::from(&cli.chat_template);\nif p.as_os_str().to_string_lossy().contains('/') && !p.is_file() {\n    return Err(format!(\"chat template path does not exist: {}\", p.display()));\n}","typeGuard":null,"tryCatchPattern":"match result {\n    Err(TemplateError::MissingTemplatePath) => {\n        eprintln!(\"chat template path missing; use an absolute path mounted into the container\");\n        std::process::exit(2);\n    }\n    other => other?,\n}","preventionTips":["Use absolute paths for --chat-template in containers.","Add a deploy-time existence check for template files in your launch script or entrypoint."],"tags":["rust","chat-template","file-not-found","configuration","docker"],"backgroundTag":null,"analyzedSha":"c794754062d49a8fdb63ab3c5215b488b865030c","analyzedAt":"2026-08-14T21:17:39.825Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}