reflex-dev/reflex · error · ScaleAppError
Only one of --vmtype or --regions should be provided.
Error message
Only one of --vmtype or --regions should be provided.
What it means
ScaleAppError raised in ScaleApp.create when both --vmtype and --regions are supplied. Scaling a hosting app is either VM-based or region-based, so providing both is an ambiguous/contradictory request the API rejects before building the ScaleApp.
Source
Thrown at packages/reflex-hosting-cli/src/reflex_cli/utils/hosting.py:109
"""Create a ScaleAppCliArgs object.
Args:
regions: The regions to scale to.
vm_type: The VM size to scale to.
scale_type: The scale type.
Returns:
An instance of ScaleAppCliArgs.
Raises:
ScaleAppError: If both regions and vm_type are provided.
"""
if isinstance(regions, list):
regions = dict.fromkeys(regions, 1)
if vm_type is not None and regions:
raise ScaleAppError("Only one of --vmtype or --regions should be provided.")
return cls(ScaleType(scale_type) if scale_type else None, regions, vm_type)
@property
def is_valid(self) -> bool:
"""Check if the CLI arguments are valid.
Returns:
bool: True if either vmtype or regions is set.
"""
return bool(self.regions or self.vm_type)
class Region(TypedDict):
"""Region for scaling an application."""
name: RegionOption
number_of_machines: intView on GitHub (pinned to 45b8ed5ab7)
Solutions
- Pass only one of --vmtype or --regions depending on whether you want VM-based or region-based scaling
- For region-based scaling drop --vmtype (e.g. `reflex scale --regions nyc --scaleup 1`)
- For VM-based scaling drop --regions (e.g. `reflex scale --vmtype 2 --scaleup 1`)
Example fix
# before reflex scale --vmtype 2 --regions nyc --scaleup 1 # after reflex scale --vmtype 2 --scaleup 1
Defensive patterns
Strategy: type-guard
Validate before calling
if vm_type is not None:
regions = None
elif not regions:
raise ValueError("provide exactly one of vm_type or regions")
scale = ScaleApp.create(scale_type=scale_type, regions=regions, vm_type=vm_type) Type guard
def is_valid_scale_args(vm_type, regions) -> bool:
return not (vm_type is not None and regions) Try / catch
from reflex_cli.utils.hosting import ScaleAppError
try:
scale = ScaleApp.create(scale_type, regions, vm_type)
except ScaleAppError:
scale = ScaleApp.create(scale_type, None, vm_type) # retry with vm_type only Prevention
- Pass exactly one of --vmtype or --regions to scale commands
- Decide up front between VM-based and region-based scaling for your app
When it happens
Trigger: Calling ScaleApp.create(vm_type=..., regions=...) with both non-None/non-empty, e.g. `reflex scale --vmtype 2 --regions nyc --scaleup 1` from the CLI.
Common situations: Users assuming regions constrain where a sized VM runs; combining flags copied from two different examples; scripting the API and passing every parameter defensively.
Related errors
- f"Invalid {self._cloud_config_path.name}. " + str(e)
- f"Config file not found at {yaml_path}."
- YAML support is not available. Please install PyYAML to use
- Config file not found at {pyproject_path}.
- TOML support is not available. Please use Python 3.11 or lat
AI-assisted analysis of reflex-dev/reflex@45b8ed5ab7 (2026-08-28).
Data as JSON: /api/errors/5ee6925651ea4c07.
Report an issue: GitHub.