yazinsai / srt-ai

Translate SRT files to any language, using AI magic ✨
https://translatesrt.com/
193 stars 50 forks source link

Error in the middle of the translation process #12

Open optsing opened 8 months ago

optsing commented 8 months ago

Each attempt to translate ends with the following error after few minutes of normal work:

⨯ Error: failed to pipe response
    at pipeToNodeResponse (C:\Users\optsi\projects\srt-ai\node_modules\next\dist\server\pipe-readable.js:111:15)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async sendResponse (C:\Users\optsi\projects\srt-ai\node_modules\next\dist\server\send-response.js:40:13)
    at async doRender (C:\Users\optsi\projects\srt-ai\node_modules\next\dist\server\base-server.js:1360:25)
    at async cacheEntry.responseCache.get.routeKind (C:\Users\optsi\projects\srt-ai\node_modules\next\dist\server\base-server.js:1552:28)
    at async DevServer.renderToResponseWithComponentsImpl (C:\Users\optsi\projects\srt-ai\node_modules\next\dist\server\base-server.js:1460:28)
    at async DevServer.renderPageComponent (C:\Users\optsi\projects\srt-ai\node_modules\next\dist\server\base-server.js:1843:24)
    at async DevServer.renderToResponseImpl (C:\Users\optsi\projects\srt-ai\node_modules\next\dist\server\base-server.js:1881:32)
    at async DevServer.pipeImpl (C:\Users\optsi\projects\srt-ai\node_modules\next\dist\server\base-server.js:909:25)
    at async NextNodeServer.handleCatchallRenderRequest (C:\Users\optsi\projects\srt-ai\node_modules\next\dist\server\next-server.js:266:17)
    at async DevServer.handleRequestImpl (C:\Users\optsi\projects\srt-ai\node_modules\next\dist\server\base-server.js:805:17) {
  [cause]: TypeError: Cannot read properties of undefined (reading 'timestamp')
      at Object.start (webpack-internal:///(rsc)/./app/api/route.ts:70:59)
      at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
DarrenSem commented 7 months ago

Hey OP, I am just a lurker, but glancing at your error dump...

async DevServer.handleRequestImpl (C:\Users\optsi\projects\srt-ai\node_modules\next\dist\server\base-server.js:805:17) { [cause]: TypeError: Cannot read properties of undefined (reading 'timestamp') at Object.start (webpack-internal:///(rsc)/./app/api/route.ts:70:59) ...

At a glance, that seems say that some code that accesses foo.timestamp has failed because foo is unexpectedly undefined or null.

So if I were in your place I would try redoing this inside VSC with the debugger -- first asding a conditional breakpoint on that line that fails, so it only debugs/pauses if foo == null ... and then you can at least look at all the other variable values too, maybe then you will be able to see the full problem.

That's my first instinct anyway.

Or if it seems an allowed possibility (maybe badly formatted SRT file?) then update the code to cleanly fail when foo == null, or skip that loop step and log the issue (but do not fail).

HTH!