{"record":{"id":"6de7a637ae53f989","repo":"musistudio/claude-code-router","slug":"file-not-found-filepath","errorCode":null,"errorMessage":"File not found: ${filePath}","messagePattern":"File not found: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/electron/bundled-plugins/claude-design/index.cjs","lineNumber":1190,"sourceCode":"  const limit = 200;\n  const entries = allEntries.slice(offset, offset + limit);\n  return {\n    entries,\n    limit,\n    offset,\n    projectId,\n    project_id: projectId,\n    total: allEntries.length,\n    truncated: offset + limit < allEntries.length\n  };\n}\n\nfunction getDesignSyncJsonFile(runtime, body) {\n  const projectId = designSyncJsonProjectId(body);\n  const filePath = requiredDesignMcpPath(body?.path);\n  const row = getProjectFileRow(runtime, projectId, filePath);\n  if (!row) {\n    throw new Error(`File not found: ${filePath}`);\n  }\n  const fileBody = Buffer.from(row.body_base64 || \"\", \"base64\");\n  const text = fileBody.toString(\"utf8\");\n  const binary = looksBinary(text);\n  return {\n    content: fileBody.toString(\"base64\"),\n    contentType: row.content_type || guessContentType(filePath),\n    content_type: row.content_type || guessContentType(filePath),\n    isBase64: binary,\n    is_base64: binary,\n    path: row.path,\n    projectId,\n    project_id: projectId,\n    raw: body?.raw === true,\n    size: fileBody.length,\n    version: Number(row.version) || 1\n  };\n}","sourceCodeStart":1172,"sourceCodeEnd":1208,"githubUrl":"https://github.com/musistudio/claude-code-router/blob/99f24806c6a2c660b16e53e95211c517448a6c90/packages/electron/bundled-plugins/claude-design/index.cjs#L1172-L1208","documentation":"Thrown by getDesignSyncJsonFile when no file row exists in the project database for the given projectId + path combination. The handler sanitizes the requested path, looks up the project file row, and fails when the lookup returns nothing.","triggerScenarios":"Requesting a file path that was never uploaded, was deleted, lives under a different project id, or whose sanitized form differs from the stored path (leading ./, double slashes, traversal segments).","commonSituations":"Stale file reference after the design tool re-uploaded assets under new paths; path case-sensitivity differences; passing a display path rather than the canonical stored path; listing endpoints returning paths that no longer exist.","solutions":["List the project's files first and use an exact stored path","Verify the projectId is correct for the file you want","Re-upload/regenerate the file in the design tool if it was deleted","Compare the sanitized path against the stored path (no leading ./ or ../ segments)"],"exampleFix":"// before\n{ projectId: \"proj_123\", path: \"./assets/logo.svg\" }\n\n// after\n{ projectId: \"proj_123\", path: \"assets/logo.svg\" }","handlingStrategy":"validation","validationCode":"const files = await listProjectFiles(projectId);\nconst exists = files.some(f => f.path === requestedPath);\nif (!exists) requestedPath = findClosest(files, requestedPath)?.path;","typeGuard":null,"tryCatchPattern":"try { return getDesignSyncJsonFile(runtime, body); } catch (e) { if (e instanceof Error && e.message.startsWith(\"File not found:\")) return respond(404, { error: e.message, hint: \"list files for the project\" }); throw e; }","preventionTips":["Always list files before referencing a path","Use exact canonical paths returned by the API","Re-sync after the design tool rewrites asset paths"],"tags":["file-not-found","path-resolution","design-sync","plugin"],"backgroundTag":"file-path-not-found","analyzedSha":"99f24806c6a2c660b16e53e95211c517448a6c90","analyzedAt":"2026-08-27T04:11:01.184Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}