comfyanonymous / ComfyUI

The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface.
https://www.comfy.org/
GNU General Public License v3.0
53.66k stars 5.69k forks source link

SyntaxError: Unexpected non-whitespace character after JSON at position 4 (line 1 column 5) #1982

Closed ClayShoaf closed 11 months ago

ClayShoaf commented 11 months ago

Surprised I haven't seen this issue here before. I am getting this a lot when trying to use other people's workflows.

Console output:

got prompt
Error handling request
Traceback (most recent call last):
  File "/home/user/anaconda3/envs/threeten/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 433, in _handle_request
    resp = await request_handler(request)
  File "/home/user/anaconda3/envs/threeten/lib/python3.10/site-packages/aiohttp/web_app.py", line 504, in _handle
    resp = await handler(request)
  File "/home/user/anaconda3/envs/threeten/lib/python3.10/site-packages/aiohttp/web_middlewares.py", line 117, in impl
    return await handler(request)
  File "/home/user/github/ComfyUI/server.py", line 46, in cache_control
    response: web.Response = await handler(request)
  File "/home/user/github/ComfyUI/server.py", line 469, in post_prompt
    valid = execution.validate_prompt(prompt)
  File "/home/user/github/ComfyUI/execution.py", line 598, in validate_prompt
    class_ = nodes.NODE_CLASS_MAPPINGS[prompt[x]['class_type']]
KeyError: 'class_type'
comfyanonymous commented 11 months ago

That means you don't have a custom node that they used.

jn-jairo commented 11 months ago

@comfyanonymous It is missing a backend validation for missing nodes, I got it now when I remove a custom node, restarted the server but didn't refresh the page on the browser, so I loaded a workflow, it loaded without errors, but when I queue the prompt I got that error, but if I refresh the page the error changes to the missing nodes message.

ClayShoaf commented 11 months ago

Man, I could have sworn I tried that. You're right. I restarted the server, closed and opened a new tab, and it worked. Side question, is "Ctrl+C" the best way to restart the server?

Torcelllo commented 8 months ago

Is "Ctrl+C" the best way to restart the server?

It certainly CLOSES the Server! You must then manually re-start.

jehowit commented 5 months ago

SyntaxError: Unexpected non-whitespace character after JSON at position 4 (line 1 column 5)

Followed solutions didnt work for me... please guide me ... also i can't install ipadapterapply,

same here... did you find a fix?

originalpaul commented 5 months ago

Same issue, JSON is clean, everything up to date including custom nodes and comfyui-manager, still doesn't work.

stf6 commented 5 months ago

same here, I'm trying to run this workflow: here firstly when i try loading it, i get this popup

When loading the graph, the following node types were not found: Text box Nodes that have failed to load will show as red on the graph.

no nodes show up in install missing nodes section, everything is up-to-date.

complete error message when i try running it anyway: _got prompt Error handling request Traceback (most recent call last): File "/home/studio-lab-user/.conda/envs/default/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 452, in _handle_request resp = await request_handler(request) File "/home/studio-lab-user/.conda/envs/default/lib/python3.10/site-packages/aiohttp/web_app.py", line 543, in _handle resp = await handler(request) File "/home/studio-lab-user/.conda/envs/default/lib/python3.10/site-packages/aiohttp/web_middlewares.py", line 114, in impl return await handler(request) File "/home/studio-lab-user/ComfyUI/server.py", line 41, in cache_control response: web.Response = await handler(request) File "/home/studio-lab-user/ComfyUI/server.py", line 53, in cors_middleware response = await handler(request) File "/home/studio-lab-user/ComfyUI/server.py", line 468, in post_prompt valid = execution.validate_prompt(prompt) File "/home/studio-lab-user/ComfyUI/execution.py", line 625, in validateprompt class = nodes.NODE_CLASS_MAPPINGS[prompt[x]['class_type']] KeyError: 'classtype'

and this popup in the ui:

SyntaxError: Unexpected non-whitespace character after JSON at position 4 (line 1 column 5)

pepelax commented 5 months ago

same here, I'm trying to run this workflow: here firstly when i try loading it, i get this popup

When loading the graph, the following node types were not found: Text box Nodes that have failed to load will show as red on the graph.

no nodes show up in install missing nodes section, everything is up-to-date.

complete error message when i try running it anyway: _got prompt Error handling request Traceback (most recent call last): File "/home/studio-lab-user/.conda/envs/default/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 452, in _handle_request resp = await request_handler(request) File "/home/studio-lab-user/.conda/envs/default/lib/python3.10/site-packages/aiohttp/web_app.py", line 543, in _handle resp = await handler(request) File "/home/studio-lab-user/.conda/envs/default/lib/python3.10/site-packages/aiohttp/web_middlewares.py", line 114, in impl return await handler(request) File "/home/studio-lab-user/ComfyUI/server.py", line 41, in cache_control response: web.Response = await handler(request) File "/home/studio-lab-user/ComfyUI/server.py", line 53, in cors_middleware response = await handler(request) File "/home/studio-lab-user/ComfyUI/server.py", line 468, in post_prompt valid = execution.validate_prompt(prompt) File "/home/studio-lab-user/ComfyUI/execution.py", line 625, in validateprompt class = nodes.NODE_CLASS_MAPPINGS[prompt[x]['class_type']] KeyError: 'classtype'

and this popup in the ui:

SyntaxError: Unexpected non-whitespace character after JSON at position 4 (line 1 column 5)

I have the same issue issue with My Steerable Motion workflow

ltdrdata commented 5 months ago

same here, I'm trying to run this workflow: here firstly when i try loading it, i get this popup When loading the graph, the following node types were not found: Text box Nodes that have failed to load will show as red on the graph. no nodes show up in install missing nodes section, everything is up-to-date. complete error message when i try running it anyway: _got prompt Error handling request Traceback (most recent call last): File "/home/studio-lab-user/.conda/envs/default/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 452, in _handle_request resp = await request_handler(request) File "/home/studio-lab-user/.conda/envs/default/lib/python3.10/site-packages/aiohttp/web_app.py", line 543, in _handle resp = await handler(request) File "/home/studio-lab-user/.conda/envs/default/lib/python3.10/site-packages/aiohttp/web_middlewares.py", line 114, in impl return await handler(request) File "/home/studio-lab-user/ComfyUI/server.py", line 41, in cache_control response: web.Response = await handler(request) File "/home/studio-lab-user/ComfyUI/server.py", line 53, in cors_middleware response = await handler(request) File "/home/studio-lab-user/ComfyUI/server.py", line 468, in post_prompt valid = execution.validate_prompt(prompt) File "/home/studio-lab-user/ComfyUI/execution.py", line 625, in validateprompt class = nodes.NODE_CLASS_MAPPINGS[prompt[x]['class_type']] KeyError: 'classtype' and this popup in the ui: SyntaxError: Unexpected non-whitespace character after JSON at position 4 (line 1 column 5)

I have the same issue issue with My Steerable Motion workflow

You have to resolve red nodes first, before execute workflow.