Skip to content

Conversation

@RUiNtheExtinct
Copy link

Summary

Improves custom node import failure diagnostics by showing the exception type and message in the import summary.

Before:

Import times for custom nodes:
   0.0 seconds (IMPORT FAILED): custom_nodes/my_node

After:

Import times for custom nodes:
   0.0 seconds (IMPORT FAILED: ImportError: No module named 'xyz'): custom_nodes/my_node

Problem

When custom nodes fail to import, users only see (IMPORT FAILED) in the summary. To understand why, they must scroll up through the logs to find the traceback. This is especially frustrating when multiple nodes fail.

Reported in #11454.

Changes

  • Add IMPORT_FAILED_REASONS module-level dict to store failure context
  • Capture exception type and first line of message (truncated to 100 chars)
  • Include failure reason in the import summary output
  • Full traceback is still logged separately for detailed debugging

Testing

  • Added unit tests covering:
    • Correct formatting of various exception types (ImportError, SyntaxError, etc.)
    • Truncation of long error messages
    • Multiline error handling (only first line used)
    • Summary output format

Compatibility

  • Backward compatible - no breaking changes
  • Existing behavior preserved (full traceback still logged)
  • No new dependencies

Fixes #11454

When custom nodes fail to import, the summary now shows the exception
type and message instead of just "(IMPORT FAILED)".

Before:
  0.0 seconds (IMPORT FAILED): custom_nodes/my_node

After:
  0.0 seconds (IMPORT FAILED: ImportError: No module named 'xyz'): custom_nodes/my_node

Changes:
- Add IMPORT_FAILED_REASONS dict to store failure context
- Capture exception type and first line of message (max 100 chars)
- Include failure reason in import summary output

This helps users quickly diagnose why custom nodes failed to load
without needing to scroll through the full traceback.

Fixes comfyanonymous#11454
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Custom node import failures only show “IMPORT FAILED” with no error context

1 participant