siyuan-note/siyuan · error
export custom font failed: ${response.status}
Error message
export custom font failed: ${response.status} What it means
In getExportCustomFontStyle, the kernel request to export/fetch a custom font returned a non-success HTTP status; the logged/thrown message includes the status code. The custom font CSS for export could not be produced, and safe mode or font absence is excluded before this point.
Source
Thrown at app/src/util/customFont.ts:120
console.warn("load custom font failed", error);
}
};
export const ensureSelectedCustomFonts = async (fonts: Array<{ family: string; weight: number }>) => {
await Promise.all(fonts.map((font) => ensureSelectedCustomFont(font.family, font.weight)));
};
export const getExportCustomFontStyle = async (fonts: Array<{family: string}>) => {
const families = new Set(fonts.map((font) => font.family).filter((family) =>
family.startsWith(CUSTOM_FONT_FAMILY_PREFIX)));
if (window.siyuan.config.system.safeMode || families.size === 0) {
return "";
}
const customFonts = (await loadCustomFonts()).filter((font) => isValidCustomFont(font) && families.has(font.family));
const styles = await Promise.all(customFonts.map(async (font) => {
const response = await fetch(`/custom-fonts/${font.id}`);
if (!response.ok) {
throw new Error(`export custom font failed: ${response.status}`);
}
const blob = await response.blob();
const dataURL = await new Promise<string>((resolve, reject) => {
const reader = new FileReader();
reader.onload = () => resolve(reader.result as string);
reader.onerror = () => reject(reader.error);
reader.readAsDataURL(blob);
});
return `@font-face { font-family: "${font.family}"; src: url("${dataURL}"); font-style: normal; font-weight: ${Math.max(1, Math.min(1000, font.weight || 400))}; }`;
}));
return styles.join("\n");
};
const setCustomFontStyle = (font: ICustomFont) => {
let styleElement = document.getElementById(`customFontStyle-${font.id}`) as HTMLStyleElement;
if (!styleElement) {
styleElement = document.createElement("style");
styleElement.id = `customFontStyle-${font.id}`;View on GitHub (pinned to 8641553a1f)
Solutions
- Check the kernel log for the failed font export request
- Verify the custom font files still exist under the workspace
- Retry after confirming kernel availability; export without custom fonts as a fallback
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at app/src/util/customFont.ts:120 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of siyuan-note/siyuan@8641553a1f (2026-09-11).
Data as JSON: /api/errors/db338345b07e8ee0.
Report an issue: GitHub.