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.

Source

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

      ...(workspaceRepairPreconditionFailure && typeof details?.repairPhase === "string"
        ? { repairPhase: details.repairPhase }
        : {}),
      ...(typeof details?.remediation === "string" || (structuredConnectionError && details?.remediation && typeof details.remediation === "object")
        ? { remediation: details.remediation }
        : {}),
      ...(structuredConnectionError && details?.connection ? { connection: details.connection } : {}),
      ...(structuredConnectionError && details?.subject ? { subject: details.subject } : {}),
      ...(structuredConnectionError && typeof details?.grantId === "string" ? { grantId: details.grantId } : {}),
      ...(!redactedSkillPolicyDenial && !workspaceRepairPreconditionFailure && err.details
        ? { details: err.details }
        : {}),
    });
    return;
  }

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

  const rootError = err instanceof Error ? err : new Error(String(err));
  attachErrorContext(
    req,
    res,
    err instanceof Error
      ? { message: err.message, stack: err.stack, name: err.name }
      : { message: String(err), raw: err, stack: rootError.stack, name: rootError.name },
    rootError,
  );

  const tc = getTelemetryClient();
  if (tc) trackErrorHandlerCrash(tc, { errorCode: rootError.name });

  res.status(500).json({
    error: "Internal server error",

View on GitHub (pinned to a7e689b3c3)

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@a7e689b3c3 (2026-08-18). Data as JSON: /api/errors/4fe6bf2b9bd785c8. Report an issue: GitHub.