sgl-project/sglang · error · ValueError
Config file not found: {args.config}
Error message
Config file not found: {args.config} What it means
Raised by the `serve` CLI command's validate() when --config is given but the file does not exist (os.path.exists returns False). Identical guard to the generate command's, applied before the serve command starts a server.
Source
Thrown at python/sglang/multimodal_gen/runtime/entrypoints/cli/serve.py:60
run_sgl_diffusion_webui(server_args)
class ServeSubcommand(CLISubcommand):
"""The `serve` subcommand for the sglang-diffusion CLI"""
def __init__(self) -> None:
self.name = "serve"
super().__init__()
def cmd(
self, args: argparse.Namespace, unknown_args: list[str] | None = None
) -> None:
execute_serve_cmd(args, unknown_args)
def validate(self, args: argparse.Namespace) -> None:
"""Validate the arguments for this command"""
if args.config and not os.path.exists(args.config):
raise ValueError(f"Config file not found: {args.config}")
def subparser_init(
self, subparsers: argparse._SubParsersAction
) -> FlexibleArgumentParser:
serve_parser = subparsers.add_parser(
"serve",
help="Launch the server and start FastAPI listener.",
usage="sglang serve --model-path MODEL_PATH_OR_ID [OPTIONS]",
)
serve_parser = add_multimodal_gen_serve_args(serve_parser)
return cast(FlexibleArgumentParser, serve_parser)
def cmd_init() -> list[CLISubcommand]:
return [ServeSubcommand()]
View on GitHub (pinned to 0132848349)
Solutions
- Check the exact path with ls / abspath before launching
- Use absolute paths in service/docker definitions
- Ensure the config file is included in the container image or volume mount
Defensive patterns
Strategy: validation
Validate before calling
import os
if args.config and not os.path.isfile(os.path.abspath(args.config)):
raise SystemExit(f"config not found: {args.config}") Prevention
- Mount/copy the config into the container at a fixed absolute path
- Add readiness checks in deploy scripts verifying the config exists
- Use absolute paths in docker/systemd/k8s command lines
When it happens
Trigger: Running `sglang serve --config missing.yaml` where the config path is wrong, relative to the wrong cwd, or not mounted in the deployment environment.
Common situations: Deploying with docker/k8s where the config wasn't mounted at the expected path, relative paths breaking when launched from systemd or another directory, typos.
Understand the failure class
Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.
Related errors
- Config file not found: {args.config}
- --diffusers-kwargs must be valid JSON. Got: {args.diffusers_
- Number of gpus must be positive
- error: unrecognized arguments: {' '.join(remaining)}
- Unknown serve backend {name!r}. Available values: {available
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/8c13bbdd00386907.
Report an issue: GitHub.