{"record":{"id":"5ee6925651ea4c07","repo":"reflex-dev/reflex","slug":"only-one-of-vmtype-or-regions-should-be-provid","errorCode":null,"errorMessage":"Only one of --vmtype or --regions should be provided.","messagePattern":"Only one of --vmtype or --regions should be provided\\.","errorType":"validation","errorClass":"ScaleAppError","httpStatus":null,"severity":"error","filePath":"packages/reflex-hosting-cli/src/reflex_cli/utils/hosting.py","lineNumber":109,"sourceCode":"        \"\"\"Create a ScaleAppCliArgs object.\n\n        Args:\n            regions: The regions to scale to.\n            vm_type: The VM size to scale to.\n            scale_type: The scale type.\n\n        Returns:\n            An instance of ScaleAppCliArgs.\n\n        Raises:\n            ScaleAppError: If both regions and vm_type are provided.\n\n        \"\"\"\n        if isinstance(regions, list):\n            regions = dict.fromkeys(regions, 1)\n\n        if vm_type is not None and regions:\n            raise ScaleAppError(\"Only one of --vmtype or --regions should be provided.\")\n        return cls(ScaleType(scale_type) if scale_type else None, regions, vm_type)\n\n    @property\n    def is_valid(self) -> bool:\n        \"\"\"Check if the CLI arguments are valid.\n\n        Returns:\n            bool: True if either vmtype or regions is set.\n\n        \"\"\"\n        return bool(self.regions or self.vm_type)\n\n\nclass Region(TypedDict):\n    \"\"\"Region for scaling an application.\"\"\"\n\n    name: RegionOption\n    number_of_machines: int","sourceCodeStart":91,"sourceCodeEnd":127,"githubUrl":"https://github.com/reflex-dev/reflex/blob/45b8ed5ab735f8a56bbb09a42384f030eb0208e7/packages/reflex-hosting-cli/src/reflex_cli/utils/hosting.py#L91-L127","documentation":"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.","triggerScenarios":"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.","commonSituations":"Users assuming regions constrain where a sized VM runs; combining flags copied from two different examples; scripting the API and passing every parameter defensively.","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`)"],"exampleFix":"# before\nreflex scale --vmtype 2 --regions nyc --scaleup 1\n\n# after\nreflex scale --vmtype 2 --scaleup 1","handlingStrategy":"type-guard","validationCode":"if vm_type is not None:\n    regions = None\nelif not regions:\n    raise ValueError(\"provide exactly one of vm_type or regions\")\nscale = ScaleApp.create(scale_type=scale_type, regions=regions, vm_type=vm_type)","typeGuard":"def is_valid_scale_args(vm_type, regions) -> bool:\n    return not (vm_type is not None and regions)","tryCatchPattern":"from reflex_cli.utils.hosting import ScaleAppError\ntry:\n    scale = ScaleApp.create(scale_type, regions, vm_type)\nexcept ScaleAppError:\n    scale = ScaleApp.create(scale_type, None, vm_type)  # retry with vm_type only","preventionTips":["Pass exactly one of --vmtype or --regions to scale commands","Decide up front between VM-based and region-based scaling for your app"],"tags":["cli","mutually-exclusive-args","scaling","reflex-hosting-cli"],"backgroundTag":"mutually-exclusive-arguments","analyzedSha":"45b8ed5ab735f8a56bbb09a42384f030eb0208e7","analyzedAt":"2026-08-28T19:25:27.644Z","schemaVersion":2},"datasetVersion":"2026-08-28T21:17:43.275Z"}