{"record":{"id":"9284b9d9b9e10c65","repo":"amruthpillai/reactive-resume","slug":"the-semantic-stylesheet-could-not-be-rendered-9284b9","errorCode":null,"errorMessage":"The semantic stylesheet could not be rendered.","messagePattern":"The semantic stylesheet could not be rendered\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/pdf/src/server.tsx","lineNumber":65,"sourceCode":"\t...options\n}: CreateResumePdfFileResultOptions): Promise<ResumePdfRenderResult<File>> => {\n\tconst normalizedOptions = { ...options, data: parseResumeData(options.data) };\n\tconst resolvedInspection = inspection ?? inspectResumePdf(normalizedOptions);\n\tif (hasSemanticErrors(resolvedInspection)) {\n\t\treturn { ok: false, diagnostics: resolvedInspection.diagnostics };\n\t}\n\n\treturn {\n\t\tok: true,\n\t\tvalue: await renderResumePdfFile(normalizedOptions),\n\t\tdiagnostics: resolvedInspection.diagnostics,\n\t};\n};\n\nexport const createResumePdfFile = async (options: CreateResumePdfFileOptions): Promise<File> => {\n\tconst result = await createResumePdfFileResult(options);\n\tif (!result.ok) {\n\t\tthrow new Error(\"The semantic stylesheet could not be rendered.\", { cause: result.diagnostics });\n\t}\n\treturn result.value;\n};\n","sourceCodeStart":47,"sourceCodeEnd":69,"githubUrl":"https://github.com/amruthpillai/reactive-resume/blob/3a5b12e2a40374a9571988701fcb75c5a1831c42/packages/pdf/src/server.tsx#L47-L69","documentation":"Server-side counterpart of error 129. Thrown by createResumePdfFile (server adapter) when createResumePdfFileResult returns ok:false because hasSemanticErrors(resolvedInspection) was true. The resume's semantic stylesheet produced error-level diagnostics during compile/resolve. The thrown Error's `cause` holds the SemanticCssDiagnostic[] array. This entry point is used by the Node/Hono server process (e.g. server-side PDF export, print preview). Note: the server adapter does not support publicStyleProjection, only the browser one does.","triggerScenarios":"Server-side PDF generation (e.g. an export endpoint or AI/print pipeline) calls createResumePdfFile with resume data whose semantic stylesheet has error diagnostics. inspectResumePdf runs synchronously, detects severity==='error' in diagnostics, and the Result branch returns ok:false, which the File-returning wrapper turns into a throw.","commonSituations":"Stored resume documents with semantic stylesheets that became invalid after a schema/template migration. Bulk/programmatic resume generation feeding in unvalidated CSS. A resume that renders fine in legacy mode but fails when its mode is 'semantic'. Server logs will show the throw but not the per-diagnostic detail unless the handler reads error.cause.","solutions":["Use createResumePdfFileResult instead of createResumePdfFile to get { ok:false, diagnostics } and log/handle each error-level diagnostic in the server route.","Read error.cause in any catch block around createResumePdfFile to recover the diagnostics array for logging or for returning a structured error to the client.","Repair the offending semantic CSS in the stored resume (via the builder or a migration) based on the diagnostic messages.","As a temporary mitigation, ensure the resume's stylesheet.mode is 'legacy' so resolveResumeRuntime returns empty diagnostics and rendering proceeds."],"exampleFix":"// before: server route throws, client gets a generic 500\ntry {\n  const file = await createResumePdfFile({ data, filename });\n} catch (e) {\n  // e.message === 'The semantic stylesheet could not be rendered.'\n}\n\n// after: use Result API, surface diagnostics to the client\nconst result = await createResumePdfFileResult({ data, filename });\nif (!result.ok) {\n  return c.json(\n    { error: 'stylesheet_diagnostics', diagnostics: result.diagnostics },\n    422,\n  );\n}\nconst file = result.value;","handlingStrategy":"try-catch","validationCode":"import { inspectResumePdf, hasSemanticError } from '@reactive-resume/pdf/server';\n\nconst inspection = inspectResumePdf({ data });\nif (hasSemanticErrors(inspection)) {\n  // return 422 with diagnostics instead of calling createResumePdfFile\n}","typeGuard":"import type { ResumePdfRenderResult } from '@reactive-resume/pdf/semantic';\nfunction isOk<T>(r: ResumePdfRenderResult<T>): r is Extract<ResumePdfRenderResult<T>, { ok: true }> {\n  return r.ok;\n}","tryCatchPattern":"import { createResumePdfFileResult } from '@reactive-resume/pdf/server';\n\nconst result = await createResumePdfFileResult({ data, filename });\nif (!result.ok) {\n  return c.json({ error: 'stylesheet_diagnostics', diagnostics: result.diagnostics }, 422);\n}\nconst file = result.value;","preventionTips":["Use createResumePdfFileResult in server routes to avoid throws and return structured diagnostics.","When wrapping createResumePdfFile, always read error.cause for diagnostics.","Pre-validate resumes with inspectResumePdf before persisting/serving.","Provide a legacy-mode fallback path for resumes with invalid semantic CSS."],"tags":["pdf","semantic-stylesheet","server","diagnostics","render"],"backgroundTag":null,"analyzedSha":"3a5b12e2a40374a9571988701fcb75c5a1831c42","analyzedAt":"2026-08-12T22:31:22.666Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}