Skip to content

Conversation

elijahr
Copy link

@elijahr elijahr commented Sep 23, 2025

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_URL env var for development, to allow the frontend server and the InvokeAI API server it proxies to be on separate machines.

Checklist

  • The PR has a short but descriptive title, suitable for a changelog
  • [n/a] Tests added / updated (if applicable)
  • [n/a] ❗Changes to a redux slice have a corresponding migration
  • [n/a] Documentation added / updated (if applicable)
  • [n/a] Updated What's New copy (if doing a release after this PR)

- 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.
@github-actions github-actions bot added the frontend PRs that change frontend files label Sep 23, 2025
Copy link
Collaborator

@psychedelicious psychedelicious left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +42 to +56
} 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,
});
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets use the app logger here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
frontend PRs that change frontend files
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants