paperclipai/paperclip · error

Validation error

Error message

Validation error

What it means

Zod branch of the central Express error handler: a request handler threw a ZodError (parsed request body/query failed its schema), so the middleware converts the issues into a 400 'Validation error' response with the flattened issue list instead of a 500.

Solutions

  1. Fix the request payload according to the validation error details and retry.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at server/src/middleware/error-handler.ts:129 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of paperclipai/paperclip@3f1d897a7c (2026-09-18). Data as JSON: /api/errors/4fe6bf2b9bd785c8. Report an issue: GitHub.

Appendix: source

Thrown at server/src/middleware/error-handler.ts:232

              ? { subject: responseDetails.subject }
              : {}),
            ...(structuredConnectionError &&
            typeof responseDetails?.grantId === "string"
              ? { grantId: responseDetails.grantId }
              : {}),
            ...(!redactedSkillPolicyDenial &&
            !workspaceRepairPreconditionFailure &&
            responseDetailsValue
              ? { details: responseDetailsValue }
              : {}),
          },
    );
    return;
  }

  const zodIssues = readZodIssues(err);
  if (zodIssues) {
    res.status(400).json({
      error: "Validation error",
      details: sanitizeSecretSensitiveResponse(req, zodIssues),
    });
    return;
  }

  const rootError = err instanceof Error ? err : new Error(String(err));

  // The client tore down the connection mid-request (closed tab, dropped
  // mobile network, cancelled upload): Node surfaces it as `Error: aborted`
  // with ECONNRESET. There is no server fault to report and nobody left to
  // answer, so skip the error sinks and just close out the response.
  if (
    rootError.message === "aborted" &&
    (rootError as NodeJS.ErrnoException).code === "ECONNRESET"
  ) {
    if (!res.headersSent) res.status(499);
    res.end();

View on GitHub (pinned to 3f1d897a7c)