santifer/career-ops · error · Error
Unsupported profile photo URL scheme
Error message
Unsupported profile photo URL scheme: ${photo.split(':', 1)[0]} What it means
Photo scheme validation in the CV HTML builder: the photo value carries a URL scheme (matches /^[a-z][a-z0-9+.-]+:/i) that is neither http(s): nor data:. The interpolated value is the offending scheme prefix — typically file:, ftp:, or blob:. Only https URLs, base64 data URLs, and local file paths (no scheme) are accepted.
Solutions
- Use an https:// URL for remote photos
- Use a plain absolute or repo-relative file path for local photos (drop the file: prefix)
- Use a base64 data: URL if the image must be embedded
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at build-cv-html.mjs:144 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/a59aca3c896a4b32.
Report an issue: GitHub.
Appendix: source
Thrown at build-cv-html.mjs:144
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)`);
}
let bytes;
try {
bytes = await readFile(photoPath);
} catch (err) {
throw new Error(`Profile photo not found or unreadable: ${photo} (${err.code || err.message})`);
}
if (bytes.length === 0) {
throw new Error(`Profile photo is empty: ${photo}`);
}
c.photo = `data:${mime};base64,${bytes.toString('base64')}`;View on GitHub (pinned to e7abd431fc)