Skip to content

fix: Improve error handling in generateFromDefaultEndpoint #1853

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 16, 2025

Conversation

calycekr
Copy link
Contributor

@calycekr calycekr commented Jun 13, 2025

  • Refactor error handling in the generateFromDefaultEndpoint function to prevent the Node.js process from crashing when an AbortError occurs.
  • Wrapped the getEndpoint and endpoint calls within a try...catch block to ensure that exceptions are caught and the process remains stable.

Error Log

AbortError: This operation was aborted
    at node:internal/deps/undici/undici:13510:13
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
    at async file:///app/build/server/chunks/models-BZWchM1f.js:9918:17
    at async generateFromDefaultEndpoint (file:///app/build/server/chunks/_server.ts-DQzfZKIq.js:380:23)\n    at async getReturnFromGenerator (file:///app/build/server/chunks/_server.ts-DQzfZKIq.js:405:14)
    at async generateTitle (file:///app/build/server/chunks/_server.ts-DQzfZKIq.js:2022:10)
    at async generateTitleForConversation (file:///app/build/server/chunks/_server.ts-DQzfZKIq.js:1978:19)

- Refactor error handling in the generateFromDefaultEndpoint function to prevent the Node.js process from crashing when an AbortError occurs.
- Wrapped the getEndpoint and endpoint calls within a try...catch block to ensure that exceptions are caught and the process remains stable.
Copy link
Collaborator

@nsarrazin nsarrazin left a comment

Choose a reason for hiding this comment

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

Thank you! Indeed it makes more sense like this.

@nsarrazin nsarrazin merged commit b946371 into huggingface:main Jun 16, 2025
3 checks passed
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.

2 participants