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

  1. Resolve the resume runtime / compile the stylesheet first and surface diagnostics to the user before persisting or projecting.
  2. Fix every 'error'-severity diagnostic in the stylesheet (unknown roles, invalid selectors, missing node refs).
  3. Gate the 'publish/share' action on diagnostics.filter(d => d.severity === 'error').length === 0.
  4. 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

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


AI-assisted analysis of amruthpillai/reactive-resume@3a5b12e2a4 (2026-08-12). Data as JSON: /api/errors/0f8caf86d32d8fdd. Report an issue: GitHub.