{"record":{"id":"6faf6646fc9c2a6d","repo":"amruthpillai/reactive-resume","slug":"internal-server-error-6faf66","errorCode":"INTERNAL_SERVER_ERROR","errorMessage":"Failed to create resume","messagePattern":"Failed to create resume","errorType":"exception","errorClass":"ORPCError","httpStatus":500,"severity":"error","filePath":"packages/api/src/features/resume/service.ts","lineNumber":650,"sourceCode":"\n\t\t\tawait notifyResumeUpdated({\n\t\t\t\ttype: \"resume.updated\",\n\t\t\t\tresumeId: id,\n\t\t\t\tuserId: input.userId,\n\t\t\t\tupdatedAt: new Date().toISOString(),\n\t\t\t\tmutation: \"create\",\n\t\t\t});\n\n\t\t\treturn id;\n\t\t} catch (error) {\n\t\t\tconst constraint = get(error, \"cause.constraint\") as string | undefined;\n\n\t\t\tif (constraint === \"resume_slug_user_id_unique\") {\n\t\t\t\tthrow new ORPCError(\"RESUME_SLUG_ALREADY_EXISTS\", { status: 400 });\n\t\t\t}\n\n\t\t\tconsole.error(\"Failed to create resume:\", error);\n\t\t\tthrow new ORPCError(\"INTERNAL_SERVER_ERROR\", { message: \"Failed to create resume\" });\n\t\t}\n\t},\n\n\tupdate: async (input: {\n\t\tid: string;\n\t\tuserId: string;\n\t\tname?: string;\n\t\tslug?: string;\n\t\ttags?: string[];\n\t\tdata?: ResumeData;\n\t\tisPublic?: boolean;\n\t\trestoreStylesheet?: boolean;\n\t\tskipAutoSnapshot?: boolean;\n\t}) => {\n\t\tconst resume = await db\n\t\t\t.transaction(async (tx) => {\n\t\t\t\tconst [existing] = await tx\n\t\t\t\t\t.select({","sourceCodeStart":632,"sourceCodeEnd":668,"githubUrl":"https://github.com/amruthpillai/reactive-resume/blob/3a5b12e2a40374a9571988701fcb75c5a1831c42/packages/api/src/features/resume/service.ts#L632-L668","documentation":"resumeService.create() wraps the DB insert; if it fails for any reason other than the resume_slug_user_id_unique constraint (mapped to RESUME_SLUG_ALREADY_EXISTS), it logs the cause and throws INTERNAL_SERVER_ERROR. The underlying error is written to the server console, not the response.","triggerScenarios":"DB connection loss, a NOT NULL or constraint violation other than the slug unique, schema drift between the Drizzle model and the live table, a serialization failure, or a duplicate generated id.","commonSituations":"DATABASE_URL misconfigured or the DB is down, a pending migration not applied, a new required column without a default, or transient DB instability.","solutions":["Check server logs for 'Failed to create resume:' with the full cause.","Verify the DB is reachable and migrations are applied (dotenvx run -f .env.local -- pnpm db:migrate).","Confirm no required column is null in the payload.","If it is a transient DB error (connection/serialization), retry the create."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"function buildCreateInput(input) {\n  if (!input.name || !input.slug) throw new Error('name and slug required');\n  if (!/^[a-z0-9-]+$/.test(input.slug)) throw new Error('Invalid slug');\n  return input;\n}","typeGuard":null,"tryCatchPattern":"try {\n  await resumeService.create(input);\n} catch (e) {\n  if (e.code === 'RESUME_SLUG_ALREADY_EXISTS') { /* pick a new slug */ }\n  else if (e.code === 'INTERNAL_SERVER_ERROR') {\n    // check server logs; retry only if DB was transiently down\n  } else throw e;\n}","preventionTips":["Ensure the DB is up and migrations are applied before creating resumes.","Pre-check slug uniqueness to surface RESUME_SLUG_ALREADY_EXISTS gracefully.","Retry creates only on transient DB errors, never blindly."],"tags":["resume","database","internal-server-error"],"backgroundTag":null,"analyzedSha":"3a5b12e2a40374a9571988701fcb75c5a1831c42","analyzedAt":"2026-08-12T22:31:22.666Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}