Skip to content

Conversation

@mattdawkins
Copy link
Member

@mattdawkins mattdawkins commented Dec 11, 2025

I get the following error on the latest release of DIVE when running a long-running stereo pipeline.

dive-what

This is an Express error handler but it has the wrong signature. Express error handlers need 4 parameters: (err, req, res, next). With only 3 parameters, Express treats it as a regular middleware and passes (req, res, next) - so the request object becomes err, the response object becomes req, and next becomes res.

Update(client/platform/desktop/backend/server.ts)
Updated client/platform/desktop/backend/server.ts with 2 additions
211 err: { status?: number; statusMessage?: string },
212 req: express.Request,
213 res: express.Response,
214 + // eslint-disable-next-line @typescript-eslint/no-unused-vars
215 + next: express.NextFunction,
216 ) {
217 res.status(err.status || 500).json({ message: err.statusMessage || err });
218 }

The fix is adding the next parameter. In Express, error-handling middleware must have exactly 4 parameters (err, req, res, next) for Express to recognize it as an error handler. Without next, Express was treating fail as regular middleware and passing (req, res, next) instead of (err, req, res, next), causing res to be in the req position and the actual next function to be in the res position.

When the code then called res.status(500), it was actually calling next.status(500) - and next is a function, not a response object, which is why you got TypeError: n.status is not a function.

@BryonLewis BryonLewis self-requested a review December 11, 2025 16:52
Copy link
Collaborator

@BryonLewis BryonLewis left a comment

Choose a reason for hiding this comment

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

Just tested locally building and restarted the Github Actions and it built.
Nice find and I think I might have normally ignored it because I typically don't have long running tasks.

@BryonLewis BryonLewis merged commit 5d2c382 into main Dec 11, 2025
5 of 8 checks passed
@BryonLewis BryonLewis deleted the dev/fix-runtime-error-lin-desktop branch December 11, 2025 17:01
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