santifer/career-ops · error · Error
Unsupported profile photo data URL (expected base64 PNG…
Error message
Unsupported profile photo data URL (expected base64 PNG, JPEG, WebP, or GIF)
What it means
Photo validation in the CV HTML builder: the photo field starts with "data:" but does not match IMAGE_DATA_URL_RE — it is not a well-formed base64 data URL for PNG, JPEG, WebP, or GIF. Common faults: an SVG or other unsupported MIME type, a missing "base64" marker, or truncated/corrupted base64 payload.
Solutions
- Re-encode the photo as a base64 PNG/JPEG/WebP/GIF data URL
- Reference the image by absolute/relative file path or an https:// URL instead of a data URL
- If the image is SVG, convert it to PNG first — SVG avatars are not accepted
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at build-cv-html.mjs:132 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of santifer/career-ops@e7abd431fc (2026-09-16).
Data as JSON: /api/errors/b8329af0d8b69168.
Report an issue: GitHub.
Appendix: source
Thrown at build-cv-html.mjs:132
}
async function prepareCandidatePhoto(candidate) {
const c = candidate && typeof candidate === 'object' ? { ...candidate } : {};
const photo = typeof c.photo === 'string' ? c.photo.trim() : '';
const style = c.photo_style || c.photoStyle || 'rounded';
if (!PHOTO_STYLES.has(style)) {
throw new Error(`Unsupported profile photo style: ${style} (expected rounded, circle, or square)`);
}
c.photo_style = style;
if (!photo) {
c.photo = '';
return c;
}
if (photo.startsWith('data:')) {
if (!IMAGE_DATA_URL_RE.test(photo)) {
throw new Error('Unsupported profile photo data URL (expected base64 PNG, JPEG, WebP, or GIF)');
}
c.photo = photo;
return c;
}
if (/^https?:\/\//i.test(photo)) {
c.photo = photo;
return c;
}
if (/^[a-z][a-z0-9+.-]+:/i.test(photo)) {
throw new Error(`Unsupported profile photo URL scheme: ${photo.split(':', 1)[0]}`);
}
const photoPath = isAbsolute(photo) ? photo : resolve(__dirname, photo);
const mime = PHOTO_MIME_BY_EXT.get(extname(photoPath).toLowerCase());
if (!mime) {
throw new Error(`Unsupported profile photo format: ${photo} (expected PNG, JPEG, WebP, or GIF)`);View on GitHub (pinned to e7abd431fc)