windmill-labs/windmill · error

Error reading mocked API file at path

Error message

Error reading mocked API file at path

What it means

Degrading warning while loading the mocked API in the TS client: fs.readFile threw on the path in WM_MOCKED_API_FILE (file missing or unreadable). The client falls through to the empty/no-mock path, so variables/resources lookups won't be mocked.

Source

Thrown at typescript-client/client.ts:1531

  }

  try {
    const fs = await import("node:fs/promises");
    const file = await fs.readFile(mockedPath, "utf-8");
    try {
      mockedApi = JSON.parse(file) as MockedApi;
      if (!mockedApi.variables) {
        mockedApi.variables = {};
      }
      if (!mockedApi.resources) {
        mockedApi.resources = {};
      }
      return mockedApi;
    } catch {
      console.warn("Error parsing mocked API file at path", mockedPath);
    }
  } catch {
    console.warn("Error reading mocked API file at path", mockedPath);
  }
  if (!mockedApi) {
    console.warn(
      "No mocked API file path provided at env variable WM_MOCKED_API_FILE. Using empty mocked API."
    );
    mockedApi = {
      variables: {},
      resources: {},
    };
    return mockedApi;
  }
}

interface MockedApi {
  variables: Record<string, string>;
  resources: Record<string, any>;
}

View on GitHub (pinned to e474e8803c)

Solutions

  1. Check the WM_MOCKED_API_FILE path is absolute-or-resolvable and exists
  2. Fix file permissions for the running process
  3. Unset the variable if mocking is no longer intended
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at typescript-client/client.ts:1531 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of windmill-labs/windmill@e474e8803c (2026-09-03). Data as JSON: /api/errors/8582ad964db8dc28. Report an issue: GitHub.