{"record":{"id":"0667588c942c58f0","repo":"remoteintech/remote-jobs","slug":"image-not-found-src","errorCode":null,"errorMessage":"Image not found: ${src}","messagePattern":"Image not found: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/_config/shortcodes/image.js","lineNumber":32,"sourceCode":"export const imageShortcode = async (\n  src,\n  alt = '',\n  caption = '',\n  loading = 'lazy',\n  containerClass,\n  imageClass,\n  widths = [650, 960, 1400],\n  sizes = 'auto',\n  formats = ['avif', 'webp', 'jpeg']\n) => {\n  // Prepend \"./src\" if not present\n  if (!src.startsWith('./src')) {\n    src = `./src${src}`;\n  }\n\n  // Check if file exists\n  if (!fs.existsSync(src)) {\n    console.warn(`Image not found: ${src}`);\n    return '';\n  }\n\n  const metadata = await Image(src, {\n    widths: [...widths],\n    formats: [...formats],\n    urlPath: '/assets/images/',\n    outputDir: './dist/assets/images/',\n    filenameFormat: (id, src, width, format, options) => {\n      const extension = path.extname(src);\n      const name = path.basename(src, extension);\n      return `${name}-${width}w.${format}`;\n    }\n  });\n\n  const lowsrc = metadata.jpeg[metadata.jpeg.length - 1];\n\n  const imageSources = Object.values(metadata)","sourceCodeStart":14,"sourceCodeEnd":50,"githubUrl":"https://github.com/remoteintech/remote-jobs/blob/b1dd8deb1945e5ff58f9e9c35e318f53c8871930/src/_config/shortcodes/image.js#L14-L50","documentation":"Source-missing guard in the Eleventy image shortcode at src/_config/shortcodes/image.js:30-34. The shortcode first prepends `./src` to src unless it already starts with that string (line 26-28), then calls fs.existsSync. If the resolved path is missing it console.warns `Image not found: <src>` and returns an empty string so the build continues, but the page renders without the picture. Note the prefix logic is literal concatenation, so a src like 'assets/foo.png' (no leading slash) becomes './srcassets/foo.png' and fails.","triggerScenarios":"A template/blog post references an image that was never committed under src/; the src argument lacks a leading slash so `./src` + path concatenates wrong; the file was moved/deleted but the template wasn't updated; case mismatch on a case-sensitive FS; eleventy invoked from a non-root cwd so the `./src` resolution misses.","commonSituations":"Blog post references an uploaded image that lives only in the author's working tree; image directory restructured; contributor passes a path relative to the template file rather than to src/.","solutions":["Confirm the resolved path (after the `./src` prefix) actually exists with `ls`.","Commit the missing image asset to the repo under src/.","Pass src with a leading slash (e.g. `/assets/images/foo.png`) so the prefix concatenation yields a valid path.","Run eleventy from the repository root so the relative `./src` base resolves correctly."],"exampleFix":"{# before: image lives at /assets/images/team.png but src has no leading slash #}\n{% image \"assets/images/team.png\", \"Team photo\" %}\n{# after #}\n{% image \"/assets/images/team.png\", \"Team photo\" %}","handlingStrategy":"validation","validationCode":"import { existsSync } from 'node:fs';\nfunction resolveImgSrc(src) {\n  return src.startsWith('./src') ? src : `./src${src}`;\n}\nfunction imageExists(src) {\n  return existsSync(resolveImgSrc(src));\n}","typeGuard":"function isResolvableImage(src) {\n  return typeof src === 'string' && existsSync(src.startsWith('./src') ? src : `./src${src}`);\n}","tryCatchPattern":null,"preventionTips":["Always pass src with a leading slash (e.g. `/assets/images/x.png`) so the `./src` prefix concatenates cleanly.","Commit the image asset in the same PR as the template that references it.","Run eleventy from the repository root so `./src` resolves correctly.","Watch for casing mismatches on case-sensitive filesystems."],"tags":["eleventy","image","filesystem","shortcode"],"backgroundTag":null,"analyzedSha":"b1dd8deb1945e5ff58f9e9c35e318f53c8871930","analyzedAt":"2026-08-13T04:09:00.804Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}