amruthpillai/reactive-resume · error · Error
Applied semantic stylesheet cannot be projected
Error message
Applied semantic stylesheet cannot be projected
What it means
createPublicStyleProjection resolves the resume runtime with the applied semantic stylesheet and inspects runtime.diagnostics; if any diagnostic has severity 'error' it throws, refusing to project a stylesheet that didn't compile cleanly. The projection is the public, shareable view of the resume's presentation, so an errored stylesheet cannot be exposed.
Source
Thrown at packages/pdf/src/semantic/public-projection.ts:263
data: ResumeData,
nodes: PublicStyleProjection["nodes"],
projection: ProjectionFingerprints,
): Promise<string> =>
computeRenderDataHash({
domainVersion: 1,
data: projectPublicRenderData(data),
resolvedNodes: nodes,
projectionFingerprints: projection,
});
export async function createPublicStyleProjection(input: { data: ResumeData }): Promise<PublicStyleProjection> {
const runtime = resolveResumeRuntime({
data: input.data,
template: input.data.metadata.template,
mode: resolveStylesheetMode(input.data),
});
if (runtime.diagnostics.some(({ severity }) => severity === "error")) {
throw new Error("Applied semantic stylesheet cannot be projected");
}
const structure = projectNodeStructure(runtime.sourceTree, runtime.renderTree);
const nodes = Object.freeze(
Object.fromEntries(
Object.entries(runtime.presentation).map(([nodeKey, presentation]) => [
nodeKey,
toPublicNode(presentation, structure[nodeKey] ?? {}),
]),
),
);
const projection = await projectionFingerprints(input.data);
return Object.freeze({
...projection,
renderDataHash: await hashProjection(input.data, nodes, projection),
nodes,
});
}View on GitHub (pinned to 3a5b12e2a4)
Solutions
- Resolve the resume runtime / compile the stylesheet first and surface diagnostics to the user before persisting or projecting.
- Fix every 'error'-severity diagnostic in the stylesheet (unknown roles, invalid selectors, missing node refs).
- Gate the 'publish/share' action on diagnostics.filter(d => d.severity === 'error').length === 0.
- If migrating, regenerate the stylesheet from the current schema's semantic registry.
Example fix
// before: project immediately after applying
await applyStylesheet(resumeId, source);
const projection = await createPublicStyleProjection({ data });
// after: check diagnostics first
const runtime = resolveResumeRuntime({ data, template, mode });
const errors = runtime.diagnostics.filter(d => d.severity === 'error');
if (errors.length) return showErrors(errors);
const projection = await createPublicStyleProjection({ data }); Defensive patterns
Strategy: validation
Validate before calling
const runtime = resolveResumeRuntime({ data, template: data.metadata.template, mode });
if (runtime.diagnostics.some(d => d.severity === 'error')) {
throw new Error('Cannot project: stylesheet has errors.');
} Type guard
function hasErrorDiagnostics(runtime: { diagnostics: { severity: string }[] }): boolean {
return runtime.diagnostics.some(d => d.severity === 'error');
} Try / catch
try { await createPublicStyleProjection({ data }); }
catch (e) { if (/cannot be projected/i.test(String((e as Error).message))) { /* surface compile diagnostics */ } throw e; } Prevention
- Surface compiler diagnostics before persisting/applying a stylesheet.
- Gate publish/share actions on zero error diagnostics.
- Regenerate stylesheets after schema migrations.
When it happens
Trigger: A semantic stylesheet that references unknown nodes/roles, has invalid selector syntax, or otherwise fails compilation; running projection right after applying a stylesheet that produced diagnostics the caller ignored.
Common situations: User-saved or imported stylesheet with a syntax error or unknown role; a version mismatch where the stylesheet targets node keys removed in the current schema; AI-generated stylesheet that didn't validate.
Related errors
- Public style projection does not match the resume render dat
- The semantic stylesheet could not be rendered.
- The semantic stylesheet could not be rendered.
- STYLESHEET_PARITY_FAILED
- STYLESHEET_REVISION_CONFLICT
AI-assisted analysis of amruthpillai/reactive-resume@3a5b12e2a4 (2026-08-12).
Data as JSON: /api/errors/0f8caf86d32d8fdd.
Report an issue: GitHub.