Repository: stable-diffusion-webui
Issue: [Bug]: Error when trying to generate img2img using the API
Labels: asking-for-help-with-local-system-issues

### Is there an existing issue for this?

- [X] I have searched the existing issues and checked the recent builds/commits

### What happened?

The bot errors with this issue when trying to generate img2img using the API.
![image](https://github.com/AUTOMATIC1111/stable-diffusion-webui/assets/59931746/3839de3c-897f-4e9d-a5f4-5473c16fd9f6)

### Steps to reproduce the problem

1. Write a Python program that accesses the SD WebUI img2img API
2. Try to generate an image

### What should have happened?

A progress bar appears, the image generates and the API sends a response with the image.

### Version or Commit where the problem happens

https://github.com/AUTOMATIC1111/stable-diffusion-webui/commit/f865d3e11647dfd6c7b2cdf90dde24680e58acd8

### What Python version are you running on ?

Python 3.10.x

### What platforms do you use to access the UI ?

Windows

### What device are you running WebUI on?

Nvidia GPUs (RTX 20 above)

### Cross attention optimization

Automatic

### What browsers do you use to access the UI ?

Microsoft Edge

### Command Line Arguments

```Shell
--xformers --api --disable-safe-unpickle
```


### List of extensions

<html>
<body>
<!--StartFragment-->




Cozy-Nest | https://github.com/Nevysha/Cozy-Nest.git | main | 2f4964c2 | Sun Jul 2 09:03:03 2023 | unknown
SD-CN-Animation | https://github.com/volotat/SD-CN-Animation.git | main | 2e257bbf | Tue May 30 16:49:03 2023 | unknown
SDAtom-WebUi-client-queue-ext | https://github.com/Kryptortio/SDAtom-WebUi-client-queue-ext.git | master | 9cf161b2 | Thu Jun 1 17:41:46 2023 | unknown
Stable-Diffusion-Webui-Civitai-Helper | https://github.com/butaixianran/Stable-Diffusion-Webui-Civitai-Helper.git | main | 920ca326 | Tue May 23 11:53:22 2023 | unknown
a1111-sd-webui-lycoris | https://github.com/KohakuBlueleaf/a1111-sd-webui-lycoris.git | main | 8e97bf54 | Sun Jul 9 07:44:58 2023 | unknown
aesthetic-gradients | https://github.com/AUTOMATIC1111/stable-diffusion-webui-aesthetic-gradients | master | 2624e5dd | Fri Jan 6 10:59:30 2023 | unknown
aesthetic-image-scorer | https://github.com/tsngo/stable-diffusion-webui-aesthetic-image-scorer | main | 1c3ab7a1 | Sun Dec 11 05:52:39 2022 | unknown
artists-to-study | https://github.com/camenduru/stable-diffusion-webui-artists-to-study | master | 5cd19f68 | Mon Jun 26 08:38:08 2023 | unknown
booru2prompt | https://github.com/Malisius/booru2prompt.git | master | 4bd88839 | Wed Nov 23 14:41:10 2022 | unknown
ddetailer | https://github.com/dustysys/ddetailer.git | master | 22a17414 | Mon Nov 28 09:33:31 2022 | unknown
deforum | https://github.com/deforum-art/deforum-for-automatic1111-webui | automatic1111-webui | 858c4dd6 | Sun Jul 2 16:52:11 2023 | unknown
depthmap2mask | https://github.com/Extraltodeus/depthmap2mask.git | main | 377e9224 | Thu Apr 13 04:10:08 2023 | unknown
dynamic-prompts | https://github.com/adieyal/sd-dynamic-prompting/ | main | c8ab624d | Tue Jul 11 23:53:26 2023 | unknown
images-browser | https://github.com/yfszzx/stable-diffusion-webui-images-browser | main | a42c7a30 | Sat Dec 10 11:01:30 2022 | unknown
infinite-zoom-automatic1111-webui | https://github.com/v8hid/infinite-zoom-automatic1111-webui.git | main | 1139764b | Wed May 3 17:08:52 2023 | unknown
sd-canvas-editor | https://github.com/jtydhr88/sd-canvas-editor.git | master | 12e7f72c | Fri Jun 30 01:16:49 2023 | unknown
sd-model-organizer | https://github.com/alexandersokol/sd-model-organizer.git | main | dae3299b | Sat Jun 24 14:03:50 2023 | unknown
sd-pixel | https://github.com/Leodotpy/sd-pixel.git | master | ceb493db | Wed May 31 19:57:01 2023 | unknown
sd-webui-controlnet | https://github.com/Mikubill/sd-webui-controlnet | main | 07bed6cc | Sat Jul 8 20:54:01 2023 | unknown
sd-webui-infinite-image-browsing | https://github.com/zanllp/sd-webui-infinite-image-browsing.git | main | 266d59d8 | Wed Jul 12 08:12:49 2023 | unknown
sd-webui-inpaint-anything | https://github.com/Uminosachi/sd-webui-inpaint-anything.git | main | 67248c4a | Wed Jul 12 05:39:59 2023 | unknown
sd-webui-openpose-editor | https://github.com/huchenlei/sd-webui-openpose-editor.git | main | 6534e9ee | Thu Jul 13 02:15:40 2023 | unknown
sd-webui-prompt-history | https://github.com/namkazt/sd-webui-prompt-history | main | ecd3ca2e | Thu Jun 29 15:34:41 2023 | unknown
sd-webui-regional-prompter | https://github.com/hako-mikan/sd-webui-regional-prompter.git | main | 18a512a9 | Sat Jul 1 14:41:22 2023 | unknown
sd-webui-roop | https://github.com/s0md3v/sd-webui-roop | main | e6333fbe | Fri Jul 7 09:22:59 2023 | unknown
sd-webui-text2video | https://github.com/deforum-art/sd-webui-text2video.git | main | 3f4a109a | Mon Jul 3 09:05:18 2023 | unknown
sd-webui-txt-img-to-3d-model | https://github.com/jtydhr88/sd-webui-txt-img-to-3d-model.git | master | 33bde577 | Fri Jul 7 03:42:17 2023 | unknown
stable-diffusion-webui-eyemask | https://github.com/ilian6806/stable-diffusion-webui-eyemask.git | master | 7b803a43 | Fri Jun 2 11:15:19 2023 | unknown
stable-diffusion-webui-rembg | https://github.com/AUTOMATIC1111/stable-diffusion-webui-rembg.git | master | 3d9eedbb | Sun Jun 4 13:35:24 2023 | unknown
stable-diffusion-webui-tokenizer | https://github.com/AUTOMATIC1111/stable-diffusion-webui-tokenizer.git | master | ac6d541c | Sat Dec 10 12:58:31 2022 | unknown
wildcards | https://github.com/AUTOMATIC1111/stable-diffusion-webui-wildcards | master | 6ed81ed1 | Sat Oct 29 16:18:48 2022 | unknown
LDSR | built-in | None |   | Thu Jul 13 19:41:05 2023 |  
Lora | built-in | None |   | Thu Jul 13 19:41:05 2023 |  
ScuNET | built-in | None |   | Thu Jul 13 19:41:05 2023 |  
SwinIR | built-in | None |   | Thu Jul 13 19:41:05 2023 |  
canvas-zoom-and-pan | built-in | None |   | Thu Jul 13 19:41:05 2023 |  
extra-options-section | built-in | None |   | Thu Jul 13 19:41:05 2023 |  
prompt-bracket-checker | built-in | None |   | Thu Jul 13 19:41:05 2023

<br class="Apple-interchange-newline"><!--EndFragment-->
</body>
</html>Extension	URL	Branch	Version	Date	Update
Cozy-Nest	https://github.com/Nevysha/Cozy-Nest.git	main	[2f4964c2](https://github.com/Nevysha/Cozy-Nest/commit/2f4964c24506c84c78ef1f92dbe62b7081a7ffb7)	Sun Jul 2 09:03:03 2023	unknown
SD-CN-Animation	https://github.com/volotat/SD-CN-Animation.git	main	[2e257bbf](https://github.com/volotat/SD-CN-Animation/commit/2e257bbfc3b76fb1323f7b22f820981c1b9f56b2)	Tue May 30 16:49:03 2023	unknown
SDAtom-WebUi-client-queue-ext	https://github.com/Kryptortio/SDAtom-WebUi-client-queue-ext.git	master	[9cf161b2](https://github.com/Kryptortio/SDAtom-WebUi-client-queue-ext/commit/9cf161b22edb81f40b86fd1ee9cf929f02e032c2)	Thu Jun 1 17:41:46 2023	unknown
Stable-Diffusion-Webui-Civitai-Helper	https://github.com/butaixianran/Stable-Diffusion-Webui-Civitai-Helper.git	main	[920ca326](https://github.com/butaixianran/Stable-Diffusion-Webui-Civitai-Helper/commit/920ca3267f789a72e3225c99f069bf0be0db795d)	Tue May 23 11:53:22 2023	unknown
a1111-sd-webui-lycoris	https://github.com/KohakuBlueleaf/a1111-sd-webui-lycoris.git	main	[8e97bf54](https://github.com/KohakuBlueleaf/a1111-sd-webui-lycoris/commit/8e97bf54867c25d00fc480be1ab4dae5399b35ef)	Sun Jul 9 07:44:58 2023	unknown
aesthetic-gradients	https://github.com/AUTOMATIC1111/stable-diffusion-webui-aesthetic-gradients	master	[2624e5dd](https://github.com/AUTOMATIC1111/stable-diffusion-webui-aesthetic-gradients/commit/2624e5dd4902cb731287b426ad483e741ece85bb)	Fri Jan 6 10:59:30 2023	unknown
aesthetic-image-scorer	https://github.com/tsngo/stable-diffusion-webui-aesthetic-image-scorer	main	[1c3ab7a1](https://github.com/tsngo/stable-diffusion-webui-aesthetic-image-scorer/commit/1c3ab7a116ab5bc3b81d718e6383edd98903a01f)	Sun Dec 11 05:52:39 2022	unknown
artists-to-study	https://github.com/camenduru/stable-diffusion-webui-artists-to-study	master	[5cd19f68](https://github.com/camenduru/stable-diffusion-webui-artists-to-study/commit/5cd19f68f65e994fc2ef2700bed4d9efe28e48b4)	Mon Jun 26 08:38:08 2023	unknown
booru2prompt	https://github.com/Malisius/booru2prompt.git	master	[4bd88839](https://github.com/Malisius/booru2prompt/commit/4bd88839a6454428d098c7ad6672cc0989dd6a60)	Wed Nov 23 14:41:10 2022	unknown
ddetailer	https://github.com/dustysys/ddetailer.git	master	[22a17414](https://github.com/dustysys/ddetailer/commit/22a17414bbca1fa4681d427b8aae5f970d17e896)	Mon Nov 28 09:33:31 2022	unknown
deforum	https://github.com/deforum-art/deforum-for-automatic1111-webui	automatic1111-webui	[858c4dd6](https://github.com/deforum-art/deforum-for-automatic1111-webui/commit/858c4dd6fd030449c23882724c67ee9398b4fd05)	Sun Jul 2 16:52:11 2023	unknown
depthmap2mask	https://github.com/Extraltodeus/depthmap2mask.git	main	[377e9224](https://github.com/Extraltodeus/depthmap2mask/commit/377e9224dbdb169ede588a6d447ca886aab67140)	Thu Apr 13 04:10:08 2023	unknown
dynamic-prompts	https://github.com/adieyal/sd-dynamic-prompting/	main	[c8ab624d](https://github.com/adieyal/sd-dynamic-prompting//commit/c8ab624dda3ab3a75eb16270ea064679026ed615)	Tue Jul 11 23:53:26 2023	unknown
images-browser	https://github.com/yfszzx/stable-diffusion-webui-images-browser	main	[a42c7a30](https://github.com/yfszzx/stable-diffusion-webui-images-browser/commit/a42c7a30181636a05815e62426d5eff4d3340529)	Sat Dec 10 11:01:30 2022	unknown
infinite-zoom-automatic1111-webui	https://github.com/v8hid/infinite-zoom-automatic1111-webui.git	main	[1139764b](https://github.com/v8hid/infinite-zoom-automatic1111-webui/commit/1139764bf715d848dc5b8b4c8d95e2e734c7e4eb)	Wed May 3 17:08:52 2023	unknown
sd-canvas-editor	https://github.com/jtydhr88/sd-canvas-editor.git	master	[12e7f72c](https://github.com/jtydhr88/sd-canvas-editor/commit/12e7f72cdccb3ede788aa3a6f81e5c060638842d)	Fri Jun 30 01:16:49 2023	unknown
sd-model-organizer	https://github.com/alexandersokol/sd-model-organizer.git	main	[dae3299b](https://github.com/alexandersokol/sd-model-organizer/commit/dae3299b2cb902873db78615b76bf28d4cfbd4e0)	Sat Jun 24 14:03:50 2023	unknown
sd-pixel	https://github.com/Leodotpy/sd-pixel.git	master	[ceb493db](https://github.com/Leodotpy/sd-pixel/commit/ceb493db323b1cf425274fb32661de2ff2516f1b)	Wed May 31 19:57:01 2023	unknown
sd-webui-controlnet	https://github.com/Mikubill/sd-webui-controlnet	main	[07bed6cc](https://github.com/Mikubill/sd-webui-controlnet/commit/07bed6ccf8a468a45b2833cfdadc749927cbd575)	Sat Jul 8 20:54:01 2023	unknown
sd-webui-infinite-image-browsing	https://github.com/zanllp/sd-webui-infinite-image-browsing.git	main	[266d59d8](https://github.com/zanllp/sd-webui-infinite-image-browsing/commit/266d59d81820f6eaa1e9694b6814afe8e6389af8)	Wed Jul 12 08:12:49 2023	unknown
sd-webui-inpaint-anything	https://github.com/Uminosachi/sd-webui-inpaint-anything.git	main	[67248c4a](https://github.com/Uminosachi/sd-webui-inpaint-anything/commit/67248c4a4da33618f9834de157943687b70af43c)	Wed Jul 12 05:39:59 2023	unknown
sd-webui-openpose-editor	https://github.com/huchenlei/sd-webui-openpose-editor.git	main	[6534e9ee](https://github.com/huchenlei/sd-webui-openpose-editor/commit/6534e9ee1a0b47e8886daedf53c0326cbcb6408f)	Thu Jul 13 02:15:40 2023	unknown
sd-webui-prompt-history	https://github.com/namkazt/sd-webui-prompt-history	main	[ecd3ca2e](https://github.com/namkazt/sd-webui-prompt-history/commit/ecd3ca2ed5b7612da29a6080e7d5658ddee9fbe9)	Thu Jun 29 15:34:41 2023	unknown
sd-webui-regional-prompter	https://github.com/hako-mikan/sd-webui-regional-prompter.git	main	[18a512a9](https://github.com/hako-mikan/sd-webui-regional-prompter/commit/18a512a99bdc51e24f5ef59622e96cdf798b1216)	Sat Jul 1 14:41:22 2023	unknown
sd-webui-roop	https://github.com/s0md3v/sd-webui-roop	main	[e6333fbe](https://github.com/s0md3v/sd-webui-roop/commit/e6333fbe5a0f3e6a515852388151f1db2315c45d)	Fri Jul 7 09:22:59 2023	unknown
sd-webui-text2video	https://github.com/deforum-art/sd-webui-text2video.git	main	[3f4a109a](https://github.com/deforum-art/sd-webui-text2video/commit/3f4a109a69599d8d2209c60b966d1cf9ea946239)	Mon Jul 3 09:05:18 2023	unknown
sd-webui-txt-img-to-3d-model	https://github.com/jtydhr88/sd-webui-txt-img-to-3d-model.git	master	[33bde577](https://github.com/jtydhr88/sd-webui-txt-img-to-3d-model/commit/33bde577a4700be23211cb45dc9acc55b63d5311)	Fri Jul 7 03:42:17 2023	unknown
stable-diffusion-webui-eyemask	https://github.com/ilian6806/stable-diffusion-webui-eyemask.git	master	[7b803a43](https://github.com/ilian6806/stable-diffusion-webui-eyemask/commit/7b803a438f02b381903916b65cc5b15c98e3231c)	Fri Jun 2 11:15:19 2023	unknown
stable-diffusion-webui-rembg	https://github.com/AUTOMATIC1111/stable-diffusion-webui-rembg.git	master	[3d9eedbb](https://github.com/AUTOMATIC1111/stable-diffusion-webui-rembg/commit/3d9eedbbf0d585207f97d5b21e42f32c0042df70)	Sun Jun 4 13:35:24 2023	unknown
stable-diffusion-webui-tokenizer	https://github.com/AUTOMATIC1111/stable-diffusion-webui-tokenizer.git	master	[ac6d541c](https://github.com/AUTOMATIC1111/stable-diffusion-webui-tokenizer/commit/ac6d541c7032e9f9c69c8ead2ed201302b06a4fe)	Sat Dec 10 12:58:31 2022	unknown
wildcards	https://github.com/AUTOMATIC1111/stable-diffusion-webui-wildcards	master	[6ed81ed1](https://github.com/AUTOMATIC1111/stable-diffusion-webui-wildcards/commit/6ed81ed1eaee9145b596ab6385c38ffd8ce7b13f)	Sat Oct 29 16:18:48 2022	unknown
LDSR	[built-in](http://127.0.0.1:7860/)	None		Thu Jul 13 19:41:05 2023	
Lora	[built-in](http://127.0.0.1:7860/)	None		Thu Jul 13 19:41:05 2023	
ScuNET	[built-in](http://127.0.0.1:7860/)	None		Thu Jul 13 19:41:05 2023	
SwinIR	[built-in](http://127.0.0.1:7860/)	None		Thu Jul 13 19:41:05 2023	
canvas-zoom-and-pan	[built-in](http://127.0.0.1:7860/)	None		Thu Jul 13 19:41:05 2023	
extra-options-section	[built-in](http://127.0.0.1:7860/)	None		Thu Jul 13 19:41:05 2023	
prompt-bracket-checker	[built-in](http://127.0.0.1:7860/)	None		Thu Jul 13 19:41:05 2023

### Console logs

```Shell
Installing requirements

Fetching updates for midas...
Checking out commit for midas with hash: 1645b7e...


Installing requirements 1 for Infinite-Zoom

Installing SD-CN-Animation requirement: scikit-image


Installing opencv-python
Installing opencv-python for pixel extension




Checking roop requirements
Install insightface==0.7.3
Installing sd-webui-roop requirement: insightface==0.7.3
Install onnx==1.14.0
Installing sd-webui-roop requirement: onnx==1.14.0
Install onnxruntime==1.15.0
Installing sd-webui-roop requirement: onnxruntime==1.15.0
Install opencv-python==4.7.0.72
Installing sd-webui-roop requirement: opencv-python==4.7.0.72





Launching Web UI with arguments: --autolaunch --xformers --api --disable-safe-unpickle
==============================================================================
You are running torch 1.13.1+cu117.
The program is tested to work with torch 2.0.0.
To reinstall the desired version, run with commandline flag --reinstall-torch.
Beware that this will cause a lot of large files to be downloaded, as well as
there are reports of issues with training tab on the latest version.

Use --skip-version-check commandline argument to disable this check.
==============================================================================
=================================================================================
You are running xformers 0.0.16rc425.
The program is tested to work with xformers 0.0.20.
To reinstall the desired version, run with commandline flag --reinstall-xformers.

Use --skip-version-check commandline argument to disable this check.
=================================================================================
*** Error loading script: nevysha_cozy_nest.py
    Traceback (most recent call last):
      File "D:\A1111 Web UI Autoinstaller\stable-diffusion-webui\modules\scripts.py", line 274, in load_scripts
        script_module = script_loading.load_module(scriptfile.path)
      File "D:\A1111 Web UI Autoinstaller\stable-diffusion-webui\modules\script_loading.py", line 10, in load_module
        module_spec.loader.exec_module(module)
      File "<frozen importlib._bootstrap_external>", line 879, in exec_module
      File "<frozen importlib._bootstrap_external>", line 1017, in get_code
      File "<frozen importlib._bootstrap_external>", line 947, in source_to_code
      File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
      File "D:\A1111 Web UI Autoinstaller\stable-diffusion-webui\extensions\Cozy-Nest\scripts\nevysha_cozy_nest.py", line 9
        <<<<<<< HEAD
        ^^
    SyntaxError: invalid syntax

---
Civitai Helper: Get Custom Model Folder
Civitai Helper: Load setting from: D:\A1111 Web UI Autoinstaller\stable-diffusion-webui\extensions\Stable-Diffusion-Webui-Civitai-Helper\setting.json
Civitai Helper: No setting file, use default
Installing pywin32
Loading booru2prompt settings
2023-07-13 21:40:48,474 - ControlNet - INFO - ControlNet v1.1.232
ControlNet preprocessor location: D:\A1111 Web UI Autoinstaller\stable-diffusion-webui\extensions\sd-webui-controlnet\annotator\downloads
2023-07-13 21:40:48,562 - ControlNet - INFO - ControlNet v1.1.232
2023-07-13 21:40:50,625 - roop - INFO - roop v0.0.2
2023-07-13 21:40:50,626 - roop - INFO - roop v0.0.2
Loading weights [167e5bcb37] from D:\A1111 Web UI Autoinstaller\stable-diffusion-webui\models\Stable-diffusion\crosskemonoFurryModel_crosskemono25.safetensors
Creating model from config: D:\A1111 Web UI Autoinstaller\stable-diffusion-webui\configs\v1-inference.yaml
LatentDiffusion: Running in eps-prediction mode
DiffusionWrapper has 859.52 M params.
*Deforum ControlNet support: enabled*
Running on local URL:  http://127.0.0.1:7860

To create a public link, set `share=True` in `launch()`.
Startup time: 23.3s (import torch: 2.0s, import gradio: 1.2s, import ldm: 0.4s, other imports: 1.0s, load scripts: 15.2s, create ui: 2.1s, gradio launch: 0.9s, app_started_callback: 0.2s).
Applying attention optimization: xformers... done.
Textual inversion embeddings loaded(6): AS-Young, AS-Young-neg, AS-Younger, AS-Youngest, charturnerv2, easynegative
Model loaded in 7.0s (load weights from disk: 0.5s, create model: 1.5s, apply weights to model: 1.6s, apply half(): 0.7s, move model to device: 2.7s).
preload_extensions_git_metadata for 38 extensions took 5.71s
API error: POST: http://127.0.0.1:7860/sdapi/v1/img2img {'error': 'TypeError', 'detail': '', 'body': '', 'errors': "'<' not supported between instances of 'int' and 'NoneType'"}
╭───────────────────────────────────────── Traceback (most recent call last) ──────────────────────────────────────────╮
│ D:\A1111 Web UI Autoinstaller\stable-diffusion-webui\venv\lib\site-packages\anyio\streams\memory.py:94 in receive    │
│                                                                                                                      │
│ D:\A1111 Web UI Autoinstaller\stable-diffusion-webui\venv\lib\site-packages\anyio\streams\memory.py:89 in            │
│ receive_nowait                                                                                                       │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
WouldBlock

During handling of the above exception, another exception occurred:

╭───────────────────────────────────────── Traceback (most recent call last) ──────────────────────────────────────────╮
│ D:\A1111 Web UI Autoinstaller\stable-diffusion-webui\venv\lib\site-packages\starlette\middleware\base.py:78 in       │
│ call_next                                                                                                            │
│                                                                                                                      │
│ D:\A1111 Web UI Autoinstaller\stable-diffusion-webui\venv\lib\site-packages\anyio\streams\memory.py:114 in receive   │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
EndOfStream

During handling of the above exception, another exception occurred:

╭───────────────────────────────────────── Traceback (most recent call last) ──────────────────────────────────────────╮
│ D:\A1111 Web UI Autoinstaller\stable-diffusion-webui\modules\api\api.py:153 in exception_handling                    │
│                                                                                                                      │
│   152 │   │   try:                                                                                                   │
│ ❱ 153 │   │   │   return await call_next(request)                                                                    │
│   154 │   │   except Exception as e:                                                                                 │
│                                                                                                                      │
│ ╭────────────────────────────────────────────── locals ──────────────────────────────────────────────╮               │
│ │        call_next = <function BaseHTTPMiddleware.__call__.<locals>.call_next at 0x0000015AC79464D0> │               │
│ │                e = TypeError("'<' not supported between instances of 'int' and 'NoneType'")        │               │
│ │ handle_exception = <function api_middleware.<locals>.handle_exception at 0x0000015D25508B80>       │               │
│ │          request = <starlette.requests.Request object at 0x0000015D29C3B9A0>                       │               │
│ ╰────────────────────────────────────────────────────────────────────────────────────────────────────╯               │
│                                                                                                                      │
│ D:\A1111 Web UI Autoinstaller\stable-diffusion-webui\venv\lib\site-packages\starlette\middleware\base.py:84 in       │
│ call_next                                                                                                            │
│                                                                                                                      │
│                                               ... 21 frames hidden ...                                               │
│                                                                                                                      │
│ D:\A1111 Web UI Autoinstaller\stable-diffusion-webui\modules\api\api.py:359 in img2imgapi                            │
│                                                                                                                      │
│   358 │   │   if not self.default_script_arg_img2img:                                                                │
│ ❱ 359 │   │   │   self.default_script_arg_img2img = self.init_default_script_args(script_runne                       │
│   360 │   │   selectable_scripts, selectable_script_idx = self.get_selectable_script(img2imgre                       │
│                                                                                                                      │
│ ╭───────────────────────────────────────────────────── locals ─────────────────────────────────────────────────────╮ │
│ │    img2imgreq = StableDiffusionProcessingImg2Img(                                                                │ │
│ │                 │   init_images=[                                                                                │ │
│ │                 │   │                                                                                            │ │
│ │                 'iVBORw0KGgoAAAANSUhEUgAAAgAAAAIACAIAAAB7GkOtAAEAAElEQVR4nLz957ctyXEnikVEZtV2x1/b'+398204        │ │
│ │                 │   ],                                                                                           │ │
│ │                 │   resize_mode=0,                                                                               │ │
│ │                 │   denoising_strength=0.75,                                                                     │ │
│ │                 │   image_cfg_scale=None,                                                                        │ │
│ │                 │   mask=None,                                                                                   │ │
│ │                 │   mask_blur=None,                                                                              │ │
│ │                 │   mask_blur_x=4,                                                                               │ │
│ │                 │   mask_blur_y=4,                                                                               │ │
│ │                 │   inpainting_fill=0,                                                                           │ │
│ │                 │   inpaint_full_res=True,                                                                       │ │
│ │                 │   inpaint_full_res_padding=0,                                                                  │ │
│ │                 │   inpainting_mask_invert=0,                                                                    │ │
│ │                 │   initial_noise_multiplier=None,                                                               │ │
│ │                 │   prompt='kitty',                                                                              │ │
│ │                 │   styles=None,                                                                                 │ │
│ │                 │   seed=-1,                                                                                     │ │
│ │                 │   subseed=-1,                                                                                  │ │
│ │                 │   subseed_strength=0,                                                                          │ │
│ │                 │   seed_resize_from_h=-1,                                                                       │ │
│ │                 │   seed_resize_from_w=-1,                                                                       │ │
│ │                 │   sampler_name='Euler a',                                                                      │ │
│ │                 │   batch_size=1,                                                                                │ │
│ │                 │   n_iter=1,                                                                                    │ │
│ │                 │   steps=50,                                                                                    │ │
│ │                 │   cfg_scale=7.0,                                                                               │ │
│ │                 │   width=512,                                                                                   │ │
│ │                 │   height=512,                                                                                  │ │
│ │                 │   restore_faces=False,                                                                         │ │
│ │                 │   tiling=False,                                                                                │ │
│ │                 │   do_not_save_samples=False,                                                                   │ │
│ │                 │   do_not_save_grid=False,                                                                      │ │
│ │                 │   negative_prompt='(low quality, worst quality:1.4), (bad anatomy)',                           │ │
│ │                 │   eta=None,                                                                                    │ │
│ │                 │   s_min_uncond=0.0,                                                                            │ │
│ │                 │   s_churn=0.0,                                                                                 │ │
│ │                 │   s_tmax=None,                                                                                 │ │
│ │                 │   s_tmin=0.0,                                                                                  │ │
│ │                 │   s_noise=1.0,                                                                                 │ │
│ │                 │   override_settings=None,                                                                      │ │
│ │                 │   override_settings_restore_afterwards=True,                                                   │ │
│ │                 │   script_args=[],                                                                              │ │
│ │                 │   sampler_index='Euler',                                                                       │ │
│ │                 │   include_init_images=False,                                                                   │ │
│ │                 │   script_name=None,                                                                            │ │
│ │                 │   send_images=True,                                                                            │ │
│ │                 │   save_images=False,                                                                           │ │
│ │                 │   alwayson_scripts={}                                                                          │ │
│ │                 )                                                                                                │ │
│ │   init_images = ['iVBORw0KGgoAAAANSUhEUgAAAgAAAAIACAIAAAB7GkOtAAEAAElEQVR4nLz957ctyXEnikVEZtV2x1/b'+398204]      │ │
│ │          mask = None                                                                                             │ │
│ │ script_runner = <modules.scripts.ScriptRunner object at 0x0000015AC78CFB20>                                      │ │
│ │          self = <modules.api.api.Api object at 0x0000015B39388490>                                               │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │
│                                                                                                                      │
│ D:\A1111 Web UI Autoinstaller\stable-diffusion-webui\modules\api\api.py:260 in init_default_script_args              │
│                                                                                                                      │
│   259 │   │   for script in script_runner.scripts:                                                                   │
│ ❱ 260 │   │   │   if last_arg_index < script.args_to:                                                                │
│   261 │   │   │   │   last_arg_index = script.args_to                                                                │
│                                                                                                                      │
│ ╭─────────────────────────────────────────── locals ───────────────────────────────────────────╮                     │
│ │ last_arg_index = 315                                                                         │                     │
│ │         script = <extra_options_section.py.ExtraOptionsSection object at 0x0000015AFC385330> │                     │
│ │  script_runner = <modules.scripts.ScriptRunner object at 0x0000015AC78CFB20>                 │                     │
│ │           self = <modules.api.api.Api object at 0x0000015B39388490>                          │                     │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯                     │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
TypeError: '<' not supported between instances of 'int' and 'NoneType'
```


### Additional information

The issue doesn't happen when using txt2img, controlnet, or interrogation through the API, or when using img2img through the WebUI. It only happens with img2img API. It also used not to happen at all in the past.
The payload looks like this:
```python
payload = {
    "init_images": [
        [image data]
    ],
    "prompt": "test prompt",
    "negative_prompt": "test negative prompt",
    "sampler_name": "Euler a",
    "steps": 50,
    "seed": -1,
    "cfg_scale": 7,
    "subseed": 0
}
```
and then
```python
urlresponse = requests.post(url=f'http://127.0.0.1:7860/sdapi/v1/img2img', json=payload)
```