amruthpillai/reactive-resume · error · ORPCError
BAD_REQUEST
BAD_REQUEST
Error message
Resume data does not match the canonical schema.
What it means
parseWritableResumeData() runs the canonical Zod resume schema (parseResumeData) over client-supplied data and maps any failure to BAD_REQUEST. This is the validation gate for create/update/patch inputs. The original Zod error is attached as error.cause for diagnostics.
Source
Thrown at packages/api/src/features/resume/resume-data-validation.ts:9
import type { ResumeData } from "@reactive-resume/schema/resume/data";
import { ORPCError } from "@orpc/client";
import { parseResumeData } from "@reactive-resume/schema/resume/data";
function parseApiResumeData(data: unknown, code: "BAD_REQUEST" | "INTERNAL_SERVER_ERROR", message: string): ResumeData {
try {
return parseResumeData(data);
} catch (cause) {
throw new ORPCError(code, {
status: code === "BAD_REQUEST" ? 400 : 500,
message,
cause,
});
}
}
export const parseWritableResumeData = (data: unknown) =>
parseApiResumeData(data, "BAD_REQUEST", "Resume data does not match the canonical schema.");
export const parseStoredResumeData = (data: unknown) =>
parseApiResumeData(data, "INTERNAL_SERVER_ERROR", "Stored resume data does not match the canonical schema.");
View on GitHub (pinned to 3a5b12e2a4)
Solutions
- Run parseResumeData (the shared Zod schema) on the client before submitting.
- After a schema or @reactive-resume/schema bump, regenerate any seeded/default data.
- Inspect error.cause for the exact Zod path and issue to locate the offending field.
Example fix
// before
resumeService.update({ id, userId, data: partialData });
// after
import { parseResumeData } from '@reactive-resume/schema/resume/data';
const data = parseResumeData(partialData); // throws ZodError with precise path
resumeService.update({ id, userId, data }); Defensive patterns
Strategy: validation
Validate before calling
import { parseResumeData } from '@reactive-resume/schema/resume/data';
function validateResumeData(data: unknown) {
return parseResumeData(data); // throws ZodError with precise path before the API call
} Type guard
import { resumeDataSchema } from '@reactive-resume/schema/resume/data';
function isResumeData(value: unknown): value is ResumeData {
return resumeDataSchema.safeParse(value).success;
} Prevention
- Validate with the shared Zod schema on the client before any create/update/patch.
- Regenerate default/seed resume data after @reactive-resume/schema bumps.
- When an error occurs, inspect error.cause for the exact Zod path.
When it happens
Trigger: POST/PUT/PATCH resume data missing required fields, with wrong-typed values, or structurally invalid sections (e.g. a section array containing a non-object).
Common situations: A frontend sending a stale data shape after a schema upgrade, an API client hand-building the payload, or a partial object from an incomplete form.
Related errors
- BAD_REQUEST
- INTERNAL_SERVER_ERROR
- INVALID_PATCH_OPERATIONS
- JSON.stringify(flattenError(error))
- Patch produced invalid resume data: ${error instanceof Error
AI-assisted analysis of amruthpillai/reactive-resume@3a5b12e2a4 (2026-08-12).
Data as JSON: /api/errors/a121833b38579060.
Report an issue: GitHub.