Comfy-Org / Comfy-Org/ComfyUI_frontend
Media Assets (Generated) window is empty when node output is missing
- Dominant language
- TypeScript
- Stars
- 2k
- Forks
- 699
- Avg merge
- 1d 7h
- Merged PRs (30d)
- 490
Description
### Prerequisites
- [x] I am running the latest version of ComfyUI
- [x] I have custom nodes enabled
### What happened?
Occasionally, when a node has an incorrect output, the Media Assets (Generated) window fails to load with error message "Error fetching jobs..."
```
[Jobs API] Error fetching jobs: ZodError: [
{
"code": "invalid_type",
"expected": "string",
"received": "undefined",
"path": [
"jobs",
5,
"preview_output",
"filename"
],
"message": "Required"
},
{
"code": "invalid_type",
"expected": "string",
"received": "undefined",
"path": [
"jobs",
5,
"preview_output",
"subfolder"
],
"message": "Required"
},
{
"expected": "'input' | 'output' | 'temp'",
"received": "undefined",
"code": "invalid_type",
"path": [
"jobs",
5,
"preview_output",
"type"
],
"message": "Required"
}
]
```
It fails to load a job, but then all other Generated jobs are affected and not shown anymore.
Temporary fix is to use safeParse() so if there's a job that errored, it's ignored:
```
FILE=$(grep -r "Error fetching jobs" ~/miniconda3 --include="*.js" -l 2>/dev/null | head -1)
sed -i 's/let n=vn.parse(await t.json());return{jobs:n.jobs,total:n.pagination.total,offset:r}/let _r=await t.json(),_j=(_r.jobs??[]).flatMap((j)=>{let _p=vn.shape.jobs.element.safeParse(j);if(!_p.success){console.warn("[Jobs API] Skipping invalid job:",j);return[]}return[_p.data]});return{jobs:_j,total:_r.pagination?.total??_j.length,offset:r}/' "$FILE"
```
### Steps to Reproduce
1.
2.
3.
### How is this affecting you?
Visual/UI issue only
### ComfyUI Frontend Version
1.17
### Browser
Firefox
### Console Errors
```javascript
```
### Logs
```shell
```
### Additional Context
_No response_
┆Issue is synchronized with this [Notion page](https://www.notion.so/Issue-9854-Media-Assets-Generated-window-is-empty-when-node-output-is-missing-3226d73d365081e68c61c27698709e6e) by [Unito](https://www.unito.io)
Contributor guide
Assessment
This issue has not been assessed yet.