Checklist
Describe the bug
The SGLang router fails to start if it is launched without the --worker-urls command-line argument. This prevents the router from being initialized without a predefined set of workers, which is a valid use case (e.g., when workers will be registered dynamically).
The error was introduced on this commit: 09ae5b2
File: sgl-router/py_src/sglang_router/launch_router.py:208
Proposed solution:
The issue can be resolved by modifying RouterArgs.add_cli_args in sglang/sgl-router/py_src/sglang_router/launch_router.py to ensure --worker-urls defaults to an empty list.
# In RouterArgs.add_cli_args:
parser.add_argument(
"--worker-urls",
type=str,
nargs="*", # Allow zero or more arguments
default=[], # Default to an empty list
help="List of worker URLs (e.g., http://worker1:8000 http://worker2:8000)",
)```
### Reproduction
1. Run the router launcher from the command line without providing any worker URLs.
`python -m sglang_router.launch_router --port 30000 --host 0.0.0.0 --policy random`
The router crashes with a TypeError because the underlying Rust component receives None instead of a list for the worker_urls parameter.
Error starting router: argument 'worker_urls': 'NoneType' object cannot be converted to 'Sequence'
Traceback (most recent call last):
File ".../sglang_router/launch_router.py", line 473, in main
launch_router(router_args)
File ".../sglang_router/launch_router.py", line 392, in launch_router
router = Router(...)
File ".../sglang_router/router.py", line 90, in init
self._router = _Router(...)
TypeError: argument 'worker_urls': 'NoneType' object cannot be converted to 'Sequence'
### Environment
This is an error on the launch script on version 0.1.5.
Checklist
Describe the bug
The SGLang router fails to start if it is launched without the --worker-urls command-line argument. This prevents the router from being initialized without a predefined set of workers, which is a valid use case (e.g., when workers will be registered dynamically).
The error was introduced on this commit: 09ae5b2
File: sgl-router/py_src/sglang_router/launch_router.py:208
Proposed solution:
The issue can be resolved by modifying RouterArgs.add_cli_args in sglang/sgl-router/py_src/sglang_router/launch_router.py to ensure --worker-urls defaults to an empty list.
Error starting router: argument 'worker_urls': 'NoneType' object cannot be converted to 'Sequence'
Traceback (most recent call last):
File ".../sglang_router/launch_router.py", line 473, in main
launch_router(router_args)
File ".../sglang_router/launch_router.py", line 392, in launch_router
router = Router(...)
File ".../sglang_router/router.py", line 90, in init
self._router = _Router(...)
TypeError: argument 'worker_urls': 'NoneType' object cannot be converted to 'Sequence'