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: int

View on GitHub (pinned to 45b8ed5ab7)

Solutions

  1. Pass only one of --vmtype or --regions depending on whether you want VM-based or region-based scaling
  2. For region-based scaling drop --vmtype (e.g. `reflex scale --regions nyc --scaleup 1`)
  3. 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

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


AI-assisted analysis of reflex-dev/reflex@45b8ed5ab7 (2026-08-28). Data as JSON: /api/errors/5ee6925651ea4c07. Report an issue: GitHub.