{"record":{"id":"e41c543a5999b945","repo":"amruthpillai/reactive-resume","slug":"internal-server-error-e41c54","errorCode":"INTERNAL_SERVER_ERROR","errorMessage":"Stored resume data does not match the canonical schema.","messagePattern":"Stored resume data does not match the canonical schema\\.","errorType":"exception","errorClass":"ORPCError","httpStatus":500,"severity":"critical","filePath":"packages/api/src/features/resume/resume-data-validation.ts","lineNumber":9,"sourceCode":"import type { ResumeData } from \"@reactive-resume/schema/resume/data\";\nimport { ORPCError } from \"@orpc/client\";\nimport { parseResumeData } from \"@reactive-resume/schema/resume/data\";\n\nfunction parseApiResumeData(data: unknown, code: \"BAD_REQUEST\" | \"INTERNAL_SERVER_ERROR\", message: string): ResumeData {\n\ttry {\n\t\treturn parseResumeData(data);\n\t} catch (cause) {\n\t\tthrow new ORPCError(code, {\n\t\t\tstatus: code === \"BAD_REQUEST\" ? 400 : 500,\n\t\t\tmessage,\n\t\t\tcause,\n\t\t});\n\t}\n}\n\nexport const parseWritableResumeData = (data: unknown) =>\n\tparseApiResumeData(data, \"BAD_REQUEST\", \"Resume data does not match the canonical schema.\");\n\nexport const parseStoredResumeData = (data: unknown) =>\n\tparseApiResumeData(data, \"INTERNAL_SERVER_ERROR\", \"Stored resume data does not match the canonical schema.\");\n","sourceCodeStart":1,"sourceCodeEnd":22,"githubUrl":"https://github.com/amruthpillai/reactive-resume/blob/3a5b12e2a40374a9571988701fcb75c5a1831c42/packages/api/src/features/resume/resume-data-validation.ts#L1-L22","documentation":"parseStoredResumeData() applies the same canonical Zod schema but to data read from the database, mapping failures to INTERNAL_SERVER_ERROR (500). It signals the persisted JSON no longer conforms — typically a schema migration that didn't transform existing rows, or corruption. The Zod error is in error.cause.","triggerScenarios":"Reading or exporting a resume whose stored data predates a now-required schema field, contains a removed enum value, or was written by an incompatible older release.","commonSituations":"Deploying a schema change without a data migration, a failed or partial migration, restoring a DB backup from an older release, or a manual DB edit.","solutions":["Run a data migration/backfill so all stored resume rows satisfy the current schema.","Inspect error.cause (the Zod error) for the failing path.","For a breaking change, add a transform/default in the schema for backward compatibility.","For one-off recovery, re-save the resume through the editor to rewrite conforming data."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"import { parseResumeData } from '@reactive-resume/schema/resume/data';\nfunction probeStored(data: unknown) {\n  const result = parseResumeData.safeParse(data);\n  if (!result.success) console.warn('Stored data fails schema:', result.error.path);\n}","typeGuard":null,"tryCatchPattern":"try {\n  await createResumePdfDownload({ id, userId });\n} catch (e) {\n  if (e.code === 'INTERNAL_SERVER_ERROR' && /Stored resume data/.test(e.message)) {\n    // flag the resume for migration/re-save rather than retrying\n  } else throw e;\n}","preventionTips":["Ship a data migration alongside every schema change that drops or tightens fields.","Add backward-compat transforms/defaults in the Zod schema for legacy rows.","After schema bumps, run a probe over stored rows to find non-conforming data early."],"tags":["resume","schema","data-integrity","zod","internal-server-error"],"backgroundTag":null,"analyzedSha":"3a5b12e2a40374a9571988701fcb75c5a1831c42","analyzedAt":"2026-08-12T22:31:22.666Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}