{"record":{"id":"eb92fc218582a175","repo":"AUTOMATIC1111/stable-diffusion-webui","slug":"axis-label-value-x-out-of-range-min-val","errorCode":null,"errorMessage":"{axis_label} value \"{x}\" out of range [{min_val}, {max_val}]","messagePattern":"(.+?) value \"(.+?)\" out of range \\[(.+?), (.+?)\\]","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"scripts/xyz_grid.py","lineNumber":104,"sourceCode":"            raise RuntimeError(f\"Unknown checkpoint: {x}\")\r\n\r\n\r\ndef confirm_checkpoints_or_none(p, xs):\r\n    for x in xs:\r\n        if x in (None, \"\", \"None\", \"none\"):\r\n            continue\r\n\r\n        if modules.sd_models.get_closet_checkpoint_match(x) is None:\r\n            raise RuntimeError(f\"Unknown checkpoint: {x}\")\r\n\r\n\r\ndef confirm_range(min_val, max_val, axis_label):\r\n    \"\"\"Generates a AxisOption.confirm() function that checks all values are within the specified range.\"\"\"\r\n\r\n    def confirm_range_fun(p, xs):\r\n        for x in xs:\r\n            if not (max_val >= x >= min_val):\r\n                raise ValueError(f'{axis_label} value \"{x}\" out of range [{min_val}, {max_val}]')\r\n\r\n    return confirm_range_fun\r\n\r\n\r\ndef apply_size(p, x: str, xs) -> None:\r\n    try:\r\n        width, _, height = x.partition('x')\r\n        width = int(width.strip())\r\n        height = int(height.strip())\r\n        p.width = width\r\n        p.height = height\r\n    except ValueError:\r\n        print(f\"Invalid size in XYZ plot: {x}\")\r\n\r\n\r\ndef find_vae(name: str):\r\n    if (name := name.strip().lower()) in ('auto', 'automatic'):\r\n        return 'Automatic'\r","sourceCodeStart":86,"sourceCodeEnd":122,"githubUrl":"https://github.com/AUTOMATIC1111/stable-diffusion-webui/blob/82a973c04367123ae98bd9abdf80d9eda9b910e2/scripts/xyz_grid.py#L86-L122","documentation":"confirm_range is a factory that builds validation closures for numeric XYZ axes (e.g. CFG scale, denoising strength). The generated confirm_range_fun checks each axis value lies within [min_val, max_val] and raises ValueError with the axis label, offending value, and allowed interval. It protects samplers/models from out-of-range parameters that would otherwise fail unpredictably later.","triggerScenarios":"Entering a numeric axis value outside the axis's supported interval, e.g. CFG scale of 0 or 40 when the axis allows [1.0, 30.0], or a negative denoising strength. Raised during axis validation before generation starts, so the entire grid aborts.","commonSituations":"Copy-pasted axis lists from tutorials using different bounds; exploring extreme values without checking the axis limits; locale/formatting issues where '1,5' is parsed oddly; extensions defining custom axes with narrow ranges.","solutions":["Clamp or correct the offending value to fall inside the interval stated in the error message.","If you genuinely need wider bounds, edit the axis definition in scripts/xyz_grid.py (min_val/max_val passed to confirm_range) or the extension that defines the axis.","Validate numeric axis lists in your script before invoking the grid."],"exampleFix":"# before (CFG axis, allowed [1.0, 30.0])\naxis_values = \"0, 7, 40\"  # 0 and 40 out of range -> ValueError\n\n# after\naxis_values = \"1, 7, 30\"  # all within [1.0, 30.0]","handlingStrategy":"validation","validationCode":"def clamp_axis_values(xs, min_val, max_val, label):\n    \"\"\"Raise before the run if any numeric axis value is out of range.\"\"\"\n    bad = [x for x in xs if not (max_val >= x >= min_val)]\n    if bad:\n        raise ValueError(f'{label} values {bad} out of range [{min_val}, {max_val}]')\n    return xs\n\nclamp_axis_values([1, 7, 30], 1.0, 30.0, \"CFG scale\")","typeGuard":"def in_range(x, min_val, max_val) -> bool:\n    \"\"\"True when x is numeric and within [min_val, max_val].\"\"\"\n    return isinstance(x, (int, float)) and min_val <= x <= max_val","tryCatchPattern":"try:\n    run_grid(p, axis_values)\nexcept ValueError as e:\n    if \"out of range\" in str(e):\n        axis_values = [min(max_val, max(min_val, x)) for x in axis_values]  # clamp and retry\n    else:\n        raise","preventionTips":["Clamp user-supplied numeric sweeps to the axis bounds before invoking the grid.","Read the error message: it states the exact allowed interval per axis label.","Keep sweep lists in config files next to their bounds so they are reviewed together."],"tags":["stable-diffusion-webui","xyz-grid","range-validation","numeric","configuration"],"backgroundTag":null,"analyzedSha":"82a973c04367123ae98bd9abdf80d9eda9b910e2","analyzedAt":"2026-08-14T16:46:43.225Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}