fix: improve workflow validation error logging and display#8594
fix: improve workflow validation error logging and display#8594elijahr wants to merge 4 commits intoinvoke-ai:mainfrom
Conversation
- Add zodErrorLogger utility for clean, structured Zod error logging - Enhanced workflow validation error messages with specific field names and node numbers - Improved .env.local loading in Vite config using loadEnv() - Simplified error handling in migration parsing - Single console.error per validation failure with complete error details - User-friendly toast notifications with truncated error summaries Fixes workflow validation error debugging for generated templates.
psychedelicious
left a comment
There was a problem hiding this comment.
Thanks! This logic hasn't been revisited since zod v4 was released. Zod now ships with a way to make its errors more user-friendly: https://zod.dev/error-formatting?id=zprettifyerror#zprettifyerror
Could you please try this utility? If it works well, we could remove the dependency on zod-validation-error and not need to worry about parsing zod errors ourselves.
| } catch (e) { | ||
| // Log file parsing/loading errors | ||
| if (e instanceof SyntaxError) { | ||
| // eslint-disable-next-line no-console | ||
| console.error('Workflow file JSON parsing failed:', { | ||
| fileName: file.name, | ||
| error: e.message, | ||
| }); | ||
| } else { | ||
| // eslint-disable-next-line no-console | ||
| console.error('Workflow file loading failed:', { | ||
| fileName: file.name, | ||
| error: e, | ||
| }); | ||
| } |
There was a problem hiding this comment.
Lets use the app logger here.
|
@elijahr Hi! I am cleaning up very old PRs and want to know if you are still interested in working on this one. It looks very close — just a few suggestions from psychedelicious to address. Please respond with a comment so I know that the PR is still active. |
|
Inactive pull request. Author is not responding to comments. |
Summary
This PR fixes validation error debugging for workflow templates by improving error logging and display.
The main focus is on making workflow validation errors easier to debug by providing clear, actionable error information to developers (via
console.error()) while maintaining a good user experience in the toast.Previously the toast would output incomplete error messaging that was not very useful for debugging.
Now the toast shows the invalid field names in addition to the failure, while maintaining the truncation ("+40 more...") if there are many failures. But the developer console shows the full error object which can be used for debugging.
Also adds support for an optional
INVOKEAI_API_BASE_URLenv var for development, to allow the frontend server and the InvokeAI API server it proxies to be on separate machines.Checklist
What's Newcopy (if doing a release after this PR)