{"record":{"id":"6e02c475df909736","repo":"slidevjs/slidev","slug":"slidev-ogimage-filename-not-found","errorCode":null,"errorMessage":"[Slidev] ogImage: ${filename} not found","messagePattern":"\\[Slidev\\] ogImage: (.+?) not found","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/slidev/node/commands/build.ts","lineNumber":124,"sourceCode":"        timeout: args.timeout || 30000,\n        perSlide: true,\n        omitBackground: false,\n        dark: args.dark,\n      })\n\n      const tempFiles = await fs.readdir(tempDir)\n      const pngFile = tempFiles.find(file => file.endsWith('.png'))\n      if (pngFile) {\n        const generatedPath = resolve(tempDir, pngFile)\n        await fs.copyFile(generatedPath, projectOgImagePath)\n        await fs.copyFile(generatedPath, outputOgImagePath)\n      }\n\n      await fs.rm(tempDir, { recursive: true, force: true })\n      server.close()\n    }\n    else {\n      throw new Error(`[Slidev] ogImage: ${filename} not found`)\n    }\n  }\n\n  // copy index.html to 404.html for GitHub Pages\n  await fs.copyFile(resolve(outDir, 'index.html'), resolve(outDir, '404.html'))\n  // _redirects for SPA\n  const redirectsPath = resolve(outDir, '_redirects')\n  if (!existsSync(redirectsPath))\n    await fs.writeFile(redirectsPath, `${config.base}*    ${config.base}index.html   200\\n`, 'utf-8')\n\n  if ([true, 'true', 'auto'].includes(options.data.config.download)) {\n    const { exportSlides, getExportOptions } = await import('./export')\n\n    const port = 12445\n    const app = connect()\n    const server = http.createServer(app)\n    app.use(\n      config.base,","sourceCodeStart":106,"sourceCodeEnd":142,"githubUrl":"https://github.com/slidevjs/slidev/blob/0d798ace5828966d9f77f62094d5f7a971ad98f7/packages/slidev/node/commands/build.ts#L106-L142","documentation":"During slidev build, if the configured ogImage file does not exist on disk and is not eligible for auto-generation (or generation produced no PNG), the build throws. Auto-generation only runs for ogImage paths ending in .png under the public-output flow.","triggerScenarios":"Setting ogImage: './missing.png' (or any non-existent image) where the file is absent and the .png auto-generation path did not produce a file.","commonSituations":"Deleting the referenced ogImage, relative-path typos, ogImage extension other than .png (no auto-gen), or upstream Playwright/render failure during generation.","solutions":["Provide a real ogImage file at the configured path","Remove the ogImage setting if none is needed","Ensure the path ends in .png so the auto-generation branch runs","Install playwright-chromium so the generation step can succeed"],"exampleFix":"// before\nogImage: ./missing.png\n// after\nogImage: ./public/og.png  (file exists)","handlingStrategy":"validation","validationCode":"import { existsSync } from 'node:fs'\nif (config.ogImage) {\n  const ogPath = resolve(publicDir, config.ogImage)\n  if (!existsSync(ogPath) && !ogPath.endsWith('.png')) {\n    throw new Error(`ogImage file not found and not auto-generatable: ${config.ogImage}`)\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep the referenced ogImage file in version control","Use a .png path so auto-generation can produce it","Ensure playwright-chromium is installed when relying on auto-generation"],"tags":["build","og-image","config"],"backgroundTag":null,"analyzedSha":"0d798ace5828966d9f77f62094d5f7a971ad98f7","analyzedAt":"2026-08-12T17:10:56.221Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}