{"record":{"id":"7be4a0a087079421","repo":"pbakaus/impeccable","slug":"not-found","errorCode":null,"errorMessage":"Not found","messagePattern":"Not found","errorType":"http","errorClass":null,"httpStatus":404,"severity":"warning","filePath":"skill/scripts/live-server.mjs","lineNumber":892,"sourceCode":"    //                              mdNewerThanJson, parseError?, sidecarError? }\n    //                          - parsed: output of parseDesignMd (frontmatter\n    //                            + the canonical sections) when DESIGN.md exists.\n    //                          - sidecar: .impeccable/design.json contents when present.\n    //                            Expected shape: schemaVersion 2, carrying\n    //                            extensions + components + narrative.\n    //   /design-system/raw     returns DESIGN.md markdown verbatim\n    if (p === '/design-system.json' || p === '/design-system/raw') {\n      const token = url.searchParams.get('token');\n      if (token !== state.token) { res.writeHead(401); res.end('Unauthorized'); return; }\n\n      const projectContext = resolveProjectContext();\n      const mdPath = projectContext.resolvedDesignPath;\n      const jsonPath = resolveDesignSidecarPath(process.cwd(), projectContext.designContextDir || projectContext.contextDir) || getDesignSidecarPath(process.cwd());\n      const mdStat = statOrNull(mdPath);\n      const jsonStat = statOrNull(jsonPath);\n\n      if (p === '/design-system/raw') {\n        if (!mdStat) { res.writeHead(404); res.end('Not found'); return; }\n        res.writeHead(200, { 'Content-Type': 'text/markdown; charset=utf-8' });\n        res.end(fs.readFileSync(mdPath, 'utf-8'));\n        return;\n      }\n\n      if (!mdStat && !jsonStat) {\n        res.writeHead(404, { 'Content-Type': 'application/json' });\n        res.end(JSON.stringify({ present: false }));\n        return;\n      }\n\n      const response = {\n        present: true,\n        hasMd: !!mdStat,\n        hasSidecar: !!jsonStat,\n        mdNewerThanJson: !!(mdStat && jsonStat && mdStat.mtimeMs > jsonStat.mtimeMs + 1000),\n      };\n","sourceCodeStart":874,"sourceCodeEnd":910,"githubUrl":"https://github.com/pbakaus/impeccable/blob/f88b2837a7d7c3182e46307bbbb091a1ed547571/skill/scripts/live-server.mjs#L874-L910","documentation":"/design-system/raw serves the project's DESIGN.md verbatim and returns 404 'Not found' when statOrNull(mdPath) is null, i.e. no DESIGN.md exists at the path resolveProjectContext() resolved. Unlike /design-system.json, which answers {present:false} for the same state, the raw endpoint has no JSON fallback shape.","triggerScenarios":"GET /design-system/raw on a project where the design system was never initialized (no DESIGN.md created by the design/extract flow), or where resolveProjectContext() resolved to a different context directory than the one holding the file.","commonSituations":"Running the panel/design tooling on a fresh repo before the skill has written a DESIGN.md; moving or renaming the context dir (.impeccable/) so the resolved design path no longer points at the file.","solutions":["Run the design-system creation flow (skill scripts) so DESIGN.md is generated at the project root or context dir","Use GET /design-system.json instead: it returns 200 {present:false, hasMd, hasSidecar} instead of a hard 404 when the file is absent","Verify which path resolveProjectContext() resolved and place DESIGN.md there"],"exampleFix":"// before\nconst res = await fetch(`/design-system/raw?token=${t}`);\nif (res.status === 404) throw new Error('raw design missing');\n\n// after\nconst res = await fetch(`/design-system.json?token=${t}`);\nconst { present, hasMd } = await res.json();\nif (!present) console.log('no design system yet');","handlingStrategy":"fallback","validationCode":"import { statSync } from 'node:fs';\nfunction hasDesignMd(resolvedDesignPath) {\n  try { return statSync(resolvedDesignPath).isFile(); } catch { return false; }\n}","typeGuard":null,"tryCatchPattern":"const res = await fetch(`/design-system/raw?token=${t}`);\nif (res.status === 404) { /* fall back to defaults or /design-system.json metadata */ }","preventionTips":["Call /design-system.json first and branch on present/hasMd before hitting /raw","Generate DESIGN.md during project init if the tooling depends on it","Treat a missing DESIGN.md as an expected early-project state, not an exception"],"tags":["http-404","design-system","live-server","missing-file"],"backgroundTag":"missing-required-file","analyzedSha":"f88b2837a7d7c3182e46307bbbb091a1ed547571","analyzedAt":"2026-08-18T04:58:36.608Z","schemaVersion":2},"datasetVersion":"2026-08-21T13:17:26.733Z"}