fetch error

guys how to debug these kinds of errors i got this while fetching a url
node:internal/deps/undici/undici:11576
Error.captureStackTrace(err, this);
^

TypeError: fetch failed
at Object.fetch (node:internal/deps/undici/undici:11576:11)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async file:///home/indeevar/Personal/frontend/anime-scraper/index.js:23:18 {
cause: Error: read ECONNRESET
at TLSWrap.onStreamRead (node:internal/stream_base_commons:217:20) {
errno: -104,
code: 'ECONNRESET',
syscall: 'read'
}
}

Node.js v18.17.1
node:internal/deps/undici/undici:11576
Error.captureStackTrace(err, this);
^

TypeError: fetch failed
at Object.fetch (node:internal/deps/undici/undici:11576:11)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async file:///home/indeevar/Personal/frontend/anime-scraper/index.js:23:18 {
cause: Error: read ECONNRESET
at TLSWrap.onStreamRead (node:internal/stream_base_commons:217:20) {
errno: -104,
code: 'ECONNRESET',
syscall: 'read'
}
}

Node.js v18.17.1
sometimes its working and sometimes its not working pls help me
1 Reply
Jochem
Jochem10mo ago
cause: Error: read ECONNRESET this just means the connection was reset, probably by the server. If you control the server, there should be more info in the log as to why it reset the connection, usually an uncaught exception. If you don't control the server, you're SOL and you'll have to build in a mechanism that keeps retrying with a delay on certain exceptions