musistudio/claude-code-router · error · Error

File not found: ${filePath}

Error message

File not found: ${filePath}

What it means

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.

Source

Thrown at packages/electron/bundled-plugins/claude-design/index.cjs:1190

  const limit = 200;
  const entries = allEntries.slice(offset, offset + limit);
  return {
    entries,
    limit,
    offset,
    projectId,
    project_id: projectId,
    total: allEntries.length,
    truncated: offset + limit < allEntries.length
  };
}

function getDesignSyncJsonFile(runtime, body) {
  const projectId = designSyncJsonProjectId(body);
  const filePath = requiredDesignMcpPath(body?.path);
  const row = getProjectFileRow(runtime, projectId, filePath);
  if (!row) {
    throw new Error(`File not found: ${filePath}`);
  }
  const fileBody = Buffer.from(row.body_base64 || "", "base64");
  const text = fileBody.toString("utf8");
  const binary = looksBinary(text);
  return {
    content: fileBody.toString("base64"),
    contentType: row.content_type || guessContentType(filePath),
    content_type: row.content_type || guessContentType(filePath),
    isBase64: binary,
    is_base64: binary,
    path: row.path,
    projectId,
    project_id: projectId,
    raw: body?.raw === true,
    size: fileBody.length,
    version: Number(row.version) || 1
  };
}

View on GitHub (pinned to 99f24806c6)

Solutions

  1. List the project's files first and use an exact stored path
  2. Verify the projectId is correct for the file you want
  3. Re-upload/regenerate the file in the design tool if it was deleted
  4. Compare the sanitized path against the stored path (no leading ./ or ../ segments)

Example fix

// before
{ projectId: "proj_123", path: "./assets/logo.svg" }

// after
{ projectId: "proj_123", path: "assets/logo.svg" }
Defensive patterns

Strategy: validation

Validate before calling

const files = await listProjectFiles(projectId);
const exists = files.some(f => f.path === requestedPath);
if (!exists) requestedPath = findClosest(files, requestedPath)?.path;

Try / catch

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; }

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Related errors


AI-assisted analysis of musistudio/claude-code-router@99f24806c6 (2026-08-27). Data as JSON: /api/errors/6de7a637ae53f989. Report an issue: GitHub.