Repository: stable-diffusion-webui
Issue: [Bug]: Inpaint sketch throw errors
Labels: bug-report

### Is there an existing issue for this?

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

### What happened?

when using “inpaint sketch” of img2img, the following errors occurred after click "generate" button:

```
*** Error completing request
*** Arguments: ('task(gg8jr283ml3faiw)', 3, '1girl, black hair, blurry, breasts, brown eyes, collarbone, hair ornament, hanfu, Chinese clothes, lips, long sleeves, looking at viewer, obi, red lips, sash, solo, standing, wide sleeves', '', [], None, None, None, <PIL.Image.Image image mode=RGB size=1440x2400 at 0x2009F418700>, <PIL.Image.Image image mode=RGB size=1440x2400 at 0x2009F90F100>, None, None, 20, 'Euler a', 4, 0, 1, 1, 2, 7, 1.5, 0.55, 0, 1920, 1152, 1, 3, 0, 32, 0, '', '', '', [], False, [], '', <gradio.routes.Request object at 0x000002009F41AF20>, 0, False, '', 0.8, 2474639747, False, -1, 0, 0, 0, 0, 4, 512, 512, True, 'None', 'None', 0, 0, 0, 0, '* `CFG Scale` should be 2 or lower.', True, True, '', '', True, 50, True, 1, 0, False, 4, 0.5, 'Linear', 'None', '<p style="margin-bottom:0.75em">Recommended settings: Sampling Steps: 80-100, Sampler: Euler a, Denoising strength: 0.8</p>', 128, 8, ['left', 'right', 'up', 'down'], 1, 0.05, 128, 4, 0, ['left', 'right', 'up', 'down'], False, False, 'positive', 'comma', 0, False, False, '', '<p style="margin-bottom:0.75em">Will upscale the image by the selected scale factor; use width and height sliders to set tile size</p>', 64, 0, 2, 1, '', [], 0, '', [], 0, '', [], True, False, False, False, 0, False) {}
    Traceback (most recent call last):
      File "D:\app2\stable-diffusion-webui\modules\call_queue.py", line 57, in f
        res = list(func(*args, **kwargs))
      File "D:\app2\stable-diffusion-webui\modules\call_queue.py", line 36, in f
        res = func(*args, **kwargs)
      File "D:\app2\stable-diffusion-webui\modules\img2img.py", line 208, in img2img
        processed = process_images(p)
      File "D:\app2\stable-diffusion-webui\modules\processing.py", line 732, in process_images
        res = process_images_inner(p)
      File "D:\app2\stable-diffusion-webui\modules\processing.py", line 803, in process_images_inner
        p.init(p.all_prompts, p.all_seeds, p.all_subseeds)
      File "D:\app2\stable-diffusion-webui\modules\processing.py", line 1455, in init
        image_masked.paste(image.convert("RGBA").convert("RGBa"), mask=ImageOps.invert(self.mask_for_overlay.convert('L')))
      File "D:\app2\stable-diffusion-webui\venv\lib\site-packages\PIL\Image.py", line 1732, in paste
        self.im.paste(im, box, mask.im)
    ValueError: images do not match

---
```

### Steps to reproduce the problem

1. Go to "img2img" section
2. Go to "Inpaint sketch" tab
3. upload a image to be inpainted
4. use painting brush tool to do certain sktech on that image
5. Press "Generate" button
6. the aforementioned errors occurred


### What should have happened?

The image should be in-painted according to the settings/prompt/sketch been given. 

### Sysinfo

[sysinfo-2023-12-05-02-24.txt](https://github.com/AUTOMATIC1111/stable-diffusion-webui/files/13554237/sysinfo-2023-12-05-02-24.txt)


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

Google Chrome

### Console logs

```Shell
venv "D:\app2\stable-diffusion-webui\venv\Scripts\Python.exe"
Python 3.10.8 (tags/v3.10.8:aaaf517, Oct 11 2022, 16:50:30) [MSC v.1933 64 bit (AMD64)]
Version: v1.6.1
Commit hash: 4afaaf8a020c1df457bcf7250cb1c7f609699fa7
Launching Web UI with arguments: --medvram --opt-split-attention --xformers --disable-nan-check --ckpt-dir D:\app2\sd-models\Stable-diffusion --lora-dir D:\app2\sd-models\Lora --embeddings-dir D:\app2\sd-models\embeddings
*** "Disable all extensions" option was set, will only load built-in extensions ***
Loading weights [7c819b6d13] from D:\app2\sd-models\Stable-diffusion\majicmixRealistic_v7.safetensors
Creating model from config: D:\app2\stable-diffusion-webui\configs\v1-inference.yaml
Running on local URL:  http://127.0.0.1:7860

To create a public link, set `share=True` in `launch()`.
Startup time: 21.6s (prepare environment: 3.6s, import torch: 9.6s, import gradio: 1.2s, setup paths: 1.1s, initialize shared: 0.4s, other imports: 0.8s, setup codeformer: 0.2s, load scripts: 3.1s, create ui: 0.9s, gradio launch: 0.5s).
Applying attention optimization: xformers... done.
Model loaded in 4.7s (load weights from disk: 1.0s, load config: 0.3s, create model: 1.6s, apply weights to model: 1.1s, apply half(): 0.1s, calculate empty prompt: 0.6s).
*** Error completing request
*** Arguments: ('task(gg8jr283ml3faiw)', 3, '1girl, black hair, blurry, breasts, brown eyes, collarbone, hair ornament, hanfu, Chinese clothes, lips, long sleeves, looking at viewer, obi, red lips, sash, solo, standing, wide sleeves', '', [], None, None, None, <PIL.Image.Image image mode=RGB size=1440x2400 at 0x2009F418700>, <PIL.Image.Image image mode=RGB size=1440x2400 at 0x2009F90F100>, None, None, 20, 'Euler a', 4, 0, 1, 1, 2, 7, 1.5, 0.55, 0, 1920, 1152, 1, 3, 0, 32, 0, '', '', '', [], False, [], '', <gradio.routes.Request object at 0x000002009F41AF20>, 0, False, '', 0.8, 2474639747, False, -1, 0, 0, 0, 0, 4, 512, 512, True, 'None', 'None', 0, 0, 0, 0, '* `CFG Scale` should be 2 or lower.', True, True, '', '', True, 50, True, 1, 0, False, 4, 0.5, 'Linear', 'None', '<p style="margin-bottom:0.75em">Recommended settings: Sampling Steps: 80-100, Sampler: Euler a, Denoising strength: 0.8</p>', 128, 8, ['left', 'right', 'up', 'down'], 1, 0.05, 128, 4, 0, ['left', 'right', 'up', 'down'], False, False, 'positive', 'comma', 0, False, False, '', '<p style="margin-bottom:0.75em">Will upscale the image by the selected scale factor; use width and height sliders to set tile size</p>', 64, 0, 2, 1, '', [], 0, '', [], 0, '', [], True, False, False, False, 0, False) {}
    Traceback (most recent call last):
      File "D:\app2\stable-diffusion-webui\modules\call_queue.py", line 57, in f
        res = list(func(*args, **kwargs))
      File "D:\app2\stable-diffusion-webui\modules\call_queue.py", line 36, in f
        res = func(*args, **kwargs)
      File "D:\app2\stable-diffusion-webui\modules\img2img.py", line 208, in img2img
        processed = process_images(p)
      File "D:\app2\stable-diffusion-webui\modules\processing.py", line 732, in process_images
        res = process_images_inner(p)
      File "D:\app2\stable-diffusion-webui\modules\processing.py", line 803, in process_images_inner
        p.init(p.all_prompts, p.all_seeds, p.all_subseeds)
      File "D:\app2\stable-diffusion-webui\modules\processing.py", line 1455, in init
        image_masked.paste(image.convert("RGBA").convert("RGBa"), mask=ImageOps.invert(self.mask_for_overlay.convert('L')))
      File "D:\app2\stable-diffusion-webui\venv\lib\site-packages\PIL\Image.py", line 1732, in paste
        self.im.paste(im, box, mask.im)
    ValueError: images do not match

---
```


### Additional information

_No response_