santifer/career-ops · error · Error
Unsupported profile photo style: ${style} (expected rounded,
Error message
Unsupported profile photo style: ${style} (expected rounded, circle, or square) What it means
Validation in `prepareCandidatePhoto` (build-cv-html.mjs): the photo style (`candidate.photo_style` or `candidate.photoStyle`, default `'rounded'`) must be in `PHOTO_STYLES` = `{'rounded','circle','square'}`. Any other value is rejected before rendering so the CSS class mapping stays bounded and the template doesn't silently fall back to a wrong shape.
Source
Thrown at build-cv-html.mjs:114
}
return escapeHtml(url);
}
function sanitizeImageSrc(src) {
if (typeof src !== 'string') return '';
const value = src.trim();
if (IMAGE_DATA_URL_RE.test(value)) return escapeHtml(value);
if (/^https?:\/\//i.test(value)) return sanitizeUrl(value);
return '';
}
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;View on GitHub (pinned to 9b17a8ac97)
Solutions
- Use exactly one of: `rounded`, `circle`, `square` (lowercase, exact spelling).
- Map your UI/config labels onto these three before invoking build-cv-html.
- Normalize case upstream: `style.toLowerCase()` won't fix synonyms but will fix `Circle`.
- If you need a new shape, extend `PHOTO_STYLES` and add the matching CSS class.
- Validate in the config loader so the error surfaces at config time, not render time.
Example fix
// before (config/profile.yml) photo_style: round # after photo_style: rounded
Defensive patterns
Strategy: validation
Validate before calling
const PHOTO_STYLES = new Set(['rounded', 'circle', 'square']);
function normalizeStyle(s) {
const n = String(s || 'rounded').toLowerCase();
if (!PHOTO_STYLES.has(n)) throw new Error(`photo_style must be one of: ${[...PHOTO_STYLES].join(', ')}`);
return n;
} Type guard
function isPhotoStyle(s) {
return ['rounded', 'circle', 'square'].includes(String(s || '').toLowerCase());
} Prevention
- Use one of: rounded, circle, square (lowercase exact).
- Map UI labels (round, circular) onto these in the config loader.
- Lowercase the value before validation to tolerate capitalization.
- Extend PHOTO_STYLES intentionally if a new shape is needed.
When it happens
Trigger: Passing `photo_style: 'round'`, `'circular'`, `'oval'`, `'rect'`, `'squircle'`, `'thumbnail'`, or any non-listed token; setting `photoStyle: 'Circle'` (case-sensitive — must be lowercase); typo in YAML/JSON config.
Common situations: Profile/config uses a synonym (`round`, `circular`); capitalization mismatch; user-facing UI exposes different labels than the renderer expects; config schema drift after an upgrade; agent picks a 'reasonable' word not in the set.
Related errors
- Unsupported profile photo data URL (expected base64 PNG, JPE
- Unsupported profile photo URL scheme: ${photo.split(':', 1)[
- Unsupported profile photo format: ${photo} (expected PNG, JP
- Malformed benchmarks file at ${path}: expected a top-level "
- gmail: invalid days_back "${ctx?.settings?.days_back}" (must
AI-assisted analysis of santifer/career-ops@9b17a8ac97 (2026-08-13).
Data as JSON: /api/errors/63c4102967d5ac5c.
Report an issue: GitHub.