{"record":{"id":"726f4811c24edd9e","repo":"santifer/career-ops","slug":"unsupported-profile-photo-format-photo-expect","errorCode":null,"errorMessage":"Unsupported profile photo format: ${photo} (expected PNG, JPEG, WebP, or GIF)","messagePattern":"Unsupported profile photo format: (.+?) \\(expected PNG, JPEG, WebP, or GIF\\)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"build-cv-html.mjs","lineNumber":150,"sourceCode":"      throw new Error('Unsupported profile photo data URL (expected base64 PNG, JPEG, WebP, or GIF)');\n    }\n    c.photo = photo;\n    return c;\n  }\n\n  if (/^https?:\\/\\//i.test(photo)) {\n    c.photo = photo;\n    return c;\n  }\n\n  if (/^[a-z][a-z0-9+.-]+:/i.test(photo)) {\n    throw new Error(`Unsupported profile photo URL scheme: ${photo.split(':', 1)[0]}`);\n  }\n\n  const photoPath = isAbsolute(photo) ? photo : resolve(__dirname, photo);\n  const mime = PHOTO_MIME_BY_EXT.get(extname(photoPath).toLowerCase());\n  if (!mime) {\n    throw new Error(`Unsupported profile photo format: ${photo} (expected PNG, JPEG, WebP, or GIF)`);\n  }\n\n  let bytes;\n  try {\n    bytes = await readFile(photoPath);\n  } catch (err) {\n    throw new Error(`Profile photo not found or unreadable: ${photo} (${err.code || err.message})`);\n  }\n  if (bytes.length === 0) {\n    throw new Error(`Profile photo is empty: ${photo}`);\n  }\n  c.photo = `data:${mime};base64,${bytes.toString('base64')}`;\n  return c;\n}\n\nfunction joinItems(items) {\n  if (Array.isArray(items)) return items.join(', ');\n  return typeof items === 'string' ? items : '';","sourceCodeStart":132,"sourceCodeEnd":168,"githubUrl":"https://github.com/santifer/career-ops/blob/e7abd431fce9348a95261acac9e0c14779c35df8/build-cv-html.mjs#L132-L168","documentation":"Extension check in the CV HTML builder: the photo resolves to a local file path, but its extension is not in PHOTO_MIME_BY_EXT (only .png, .jpg/.jpeg, .webp, .gif map to a MIME type), so the builder cannot embed it. A file exists at the path but its format is unrecognized (e.g. .svg, .avif, .bmp, or a path whose extension was mistyped).","triggerScenarios":"Thrown at build-cv-html.mjs:150 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Convert the photo to PNG, JPEG, WebP, or GIF and update the path","Fix a mistyped extension that doesn't match the actual file format","Move the image to an https URL or data URL if conversion isn't possible"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e7abd431fce9348a95261acac9e0c14779c35df8","analyzedAt":"2026-09-16T06:35:29.214Z","contentChangedAt":"2026-09-16T06:35:29.214Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}