Auto-Photoshop-StableDiffusion-Plugin icon indicating copy to clipboard operation
Auto-Photoshop-StableDiffusion-Plugin copied to clipboard

ERROR: Exception in ASGI application

Open RCHZ opened this issue 2 years ago • 1 comments

After following the quick test instructions I do not see the cat test image.

Looking at cmd I see the following: INFO: 127.0.0.1:53512 - "POST /txt2img/ HTTP/1.1" 500 Internal Server Error ERROR: Exception in ASGI application

raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Looking at Anaconda (miniconda) where I have ran webui-user.bat I see the following: raise validation_error pydantic.error_wrappers.ValidationError: 1 validation error for PNGInfoResponse info none is not an allowed value (type=type_error.none.not_allowed)

RCHZ avatar Dec 22 '22 08:12 RCHZ

Hello mind if you check your api.py version in automatic1111 and see if it is the latest one? Should be this specific one https://github.com/sena-nana/stable-diffusion-webui/blob/fcd75bd8740855e0c7bc80c0e8a4e1033b76d007/modules/api/api.py and if it is not the latest, try get the latest and retest.

XyzzyMoon avatar Dec 22 '22 23:12 XyzzyMoon

@EkaMei How would I check that? Also, I do have it set up to do a git pull every time I launch webui-user.bat so everything stays up to date.

RCHZ avatar Dec 24 '22 00:12 RCHZ

You will have to check the file directly for that. There isn't really any other way to confirm. If it is up to date we probably will need more information. This plugin is still in active development so you might also need to re-add / update it and try again. There has been a few update since yesterday.

XyzzyMoon avatar Dec 24 '22 00:12 XyzzyMoon

@EkaMei Yeah, I understand it's still being developed. No worries on that end.

To update the plugin I just have to delete the server_env folder and then run start_server.bat so that it's recreated and populated again with the updated files, right?

Thanks for trying to help me out with this.

RCHZ avatar Dec 24 '22 01:12 RCHZ

That is correct.

XyzzyMoon avatar Dec 24 '22 01:12 XyzzyMoon

@EkaMei The steps I take are this:

  • Open Anaconda, navigate to where I have webui-user.bat installed and run it. It then updates anything if need or tells me it's already up to date and then spits out the local URL.
  • I double click start_server, it then runs in Windows CMD and eventually tells me startup is complete.
  • I start up Photoshop, create a new project then load the plugin through UXP. Once the plugin loads, I click generate without making any kind of changes.

After hitting generate, this shows up in CMD: image

In Anaconda, a progress bar appears, which makes me think that it is in fact communicating with the plugin.

But then this happens in Windows cmd: image image

And this in Anaconda: image

As of typing this, I did just notice this message in Windows cmd: image

Besides all that info, I'm running on Windows 11 and have the most recent version of Photoshop. I updated it right before installing the plugin.

RCHZ avatar Dec 24 '22 01:12 RCHZ

You run your automatic1111 server inside anaconda console? I haven't really see anything quite like this. what does your automatic1111 console output looks like?

Consider dropping in in our discord if you can. We might be able to help you better there.

XyzzyMoon avatar Dec 24 '22 01:12 XyzzyMoon

@EkaMei What ever tutorial I followed months and months ago instructed to use Anaconda (miniconda), been doing it that ever since. I don't think it's uncommon as I've come across a few tutorials mentioning it and THINK it was even mentioned on the Auto1111 git at some point to.

I'm not sure what you mean by "What does it look like?". To me it looks exactly like windows cmd.

As for the Discord help. That's the first place I went and was instructed to open an issue here cause the dev couldn't figure out what my problem was at that time. I think it was the dev anyway. image

RCHZ avatar Dec 24 '22 01:12 RCHZ

I see. Yes that is the dev ( we only had one ) just making sure.

From what we see here it appears that the photoshop plugin couldn't actually communicate with Automatic1111, it is returning some strange result that we can't quite reproduce.

It is not unusual for automatic1111 to be opening in anacode, that is correct. It is really just unfamiliar to me.

Did you do a git pull on automatic1111 as well? Or is that automatically done?

XyzzyMoon avatar Dec 24 '22 02:12 XyzzyMoon

@EkaMei I have it set to do a git pull every time I run, that way it's always updated.

Did you see that notice I got in cmd about a new version of pip being available? Could that have anything to do with it? image

RCHZ avatar Dec 24 '22 02:12 RCHZ

Yes, I did, and no, it shouldn't make any difference.

XyzzyMoon avatar Dec 24 '22 02:12 XyzzyMoon

@EkaMei Could it be because I'm running the plugin through cmd and auto1111 through conda, rather than both in the same? The only reason I didn't run them both in conda to begin with is because once I run webui-user.bat and it gives me the URL, it doesn't seem to let me type any more commands. Would there be a problem if I were to run start_server in conda before running webui-user.bat?

RCHZ avatar Dec 24 '22 02:12 RCHZ

It is possible. I'm not familiar with conda method. This PS plugin relies on the automatic1111 building webserver. And you haven't really include any web server console output so I can't really tell.

XyzzyMoon avatar Dec 24 '22 02:12 XyzzyMoon

Never mind. Same problem, once I run start_server in conda I'm not able to type any more commands

RCHZ avatar Dec 24 '22 02:12 RCHZ

@EkaMei I'm sorry. I don't know what you mean by provide web server console output.

RCHZ avatar Dec 24 '22 02:12 RCHZ

Try running Automatic1111 webui-user.bat as well? I'm not sure how you even define the --api tag without using the bat file. Once you run that, it should have the console output of the automatic1111 webserver.

XyzzyMoon avatar Dec 24 '22 02:12 XyzzyMoon

This is how I have my webui-user.bat set up image

RCHZ avatar Dec 24 '22 02:12 RCHZ

Right, try just running the bat file instead of running SD in anaconda. I don't know if that alters the webserver in any other ways. See if that makes any difference.

XyzzyMoon avatar Dec 24 '22 02:12 XyzzyMoon

@EkaMei OK. I just run everything with windows cmd only and the exact same thing happened.

And is this what you mean by the console output of the auto1111 web server? image

I did mention to the dev that the numbers at the end of the URL don't match up to what's being shown in the 500 Internal Server Error I get from the plugin. image

RCHZ avatar Dec 24 '22 03:12 RCHZ

The webserver works, right? As in when you go to http://127.0.0.1:7860/ on a normal browser, you can see automatic1111 interface, right?

Would be nice to see more output on that windows too. I only see that it is running, I don't see whether Automatic actually see the request or not, and what they did with it.

Anyway, to answer your question. That port number changes every time. what you are seeing until you get to the 500 internal server error, is perfectly normal. It appears that PS plugin just can't communicate with your automatic1111 server at all. Some sorta of strange firewall setting issue or antivirus stuff? Maybe?

Your process fails very early. So very few things could be wrong, we looked at everything else. This might be an environmental issue. (As in some kind of configuration on your computer might be causing it).

XyzzyMoon avatar Dec 24 '22 03:12 XyzzyMoon

@EkaMei Yes, the auto1111 user interface does work using the URL, I've been using it every day for months and still able to use it now. Alone, it is working as expected.

Here is a screen shot of Auto1111 working inside the browser with a generation of a cute cat to show you that Auto1111 is in fact in working order and able to generate images: image

Sorry if I didn't provide you with enough screen shots. I'll try to give you every thing I see and in the order that I see it. This will all be done through Windows cmd, no Anaconda.

First: I double click webui-user.bat, it then runs in cmd and this is the result: image

Second: I double click start_server.bat, it then opens in a new cmd and this is the result: image image

Third: I launch Photoshop and start a new project, then open UXP, load the plugin, go back to PS and hit generate.

Once I click generate, this text pops up in cmd window for the plugin: image

In the cmd window for Auto1111 a progress bar appears like so: image

That progress bar eventually reaches 100% but then gives an error like so: image

That same progress bar within the cmd window for Auto1111 is then followed by this: image

Back over in the cmd window for the plugin, I get this info: image

Followed by this: image

That's everything.

RCHZ avatar Dec 24 '22 04:12 RCHZ

You definitely did, unfortunately there's no where else for us to go aside from asking you to try random things like running plugin in admin mode, disable Firewall /or AV if you have defender, etc, all are a shot in the dark at this point. The problem is that our plugin can't talk to automatic on your device. Not much else to say besides that. And the reason why it doesn't communicate is beyond the plugin's ability to find out.

Maybe an update in the future will give us better tracing to find out, or maybe it will be mysteriously fixed when it get more developed, no idea.

XyzzyMoon avatar Dec 24 '22 04:12 XyzzyMoon

i got the same bug.i have read the source,but can't solve it. i think the bug is in this code, for i in r['images']: image = Image.open(io.BytesIO(base64.b64decode(i.split(",",1)[0])))

        png_payload = {
            "image": "data:image/png;base64," + i
        }
        response2 = await client.post(url=f'{sd_url}/sdapi/v1/png-info', json=png_payload)
        pnginfo = PngImagePlugin.PngInfo()

as this plugin send png_payload post data to url /sdapi/v1/png-info , like "image": "data:image/png;base64," + i, the web ui server can't decode the png base64 data.the server return 500 error. i have copy the png base64 data to offical api test url: 127.0.0.1:7860/docs, and test the http://127.0.0.1:7860/sdapi/v1/png-info post, it still return 500 error. finally i delete the plugin server_env dir,and change the enviroment to same as webui python. still no work. too hard to find the bug.....

cheng539539 avatar Dec 25 '22 15:12 cheng539539

i fix this bug by reinstall local python enviroment.this bug is case by sd webui can't generate image info.you can check you local stable diffusion webui,check if it can genenrate image meta info.

cheng539539 avatar Dec 26 '22 06:12 cheng539539

@cheng539539 Thank you, I got it to work!

@EkaMei I did a few things to make sure I had all my bases covered here. What I did was...

First: I went into my settings within Auto1111 UI and enabled "Save text information about generation parameters as chunks to png files". Previously I only had it set to save the info to a txt file.

Second: I deleted server_env and ran start_server to make sure the plugin was up to date

Third: I remembered there was that notice about a new release of pip being available. So I went ahead and updated that from 22.2.2 to 22.3.1.

Forth: I closed the cmd window where I did the update and the one for the plugin and ran start_server again.

Once I did that, I loaded the plugin with UXP and was able to generate the test cat photo in Photoshop.

RCHZ avatar Dec 26 '22 08:12 RCHZ