{"record":{"id":"1c4901c9101b8cfc","repo":"windmill-labs/windmill","slug":"error-parsing-mocked-api-file-at-path","errorCode":null,"errorMessage":"Error parsing mocked API file at path","messagePattern":"Error parsing mocked API file at path","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"typescript-client/client.ts","lineNumber":1528,"sourceCode":"    console.info(\"Using mocked API from\", mockedPath);\n  } else {\n    return undefined;\n  }\n\n  try {\n    const fs = await import(\"node:fs/promises\");\n    const file = await fs.readFile(mockedPath, \"utf-8\");\n    try {\n      mockedApi = JSON.parse(file) as MockedApi;\n      if (!mockedApi.variables) {\n        mockedApi.variables = {};\n      }\n      if (!mockedApi.resources) {\n        mockedApi.resources = {};\n      }\n      return mockedApi;\n    } catch {\n      console.warn(\"Error parsing mocked API file at path\", mockedPath);\n    }\n  } catch {\n    console.warn(\"Error reading mocked API file at path\", mockedPath);\n  }\n  if (!mockedApi) {\n    console.warn(\n      \"No mocked API file path provided at env variable WM_MOCKED_API_FILE. Using empty mocked API.\"\n    );\n    mockedApi = {\n      variables: {},\n      resources: {},\n    };\n    return mockedApi;\n  }\n}\n\ninterface MockedApi {\n  variables: Record<string, string>;","sourceCodeStart":1510,"sourceCodeEnd":1546,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/typescript-client/client.ts#L1510-L1546","documentation":"Degrading warning while loading the mocked API in the TS client: the file at WM_MOCKED_API_FILE was read successfully but JSON.parse failed (malformed JSON). The parsed mock is discarded and the client falls through to the no-mock/empty path.","triggerScenarios":"Thrown at typescript-client/client.ts:1528 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Validate the mocked API file's JSON (jsonschema/jq or a JSON linter) and fix the syntax error","Confirm the file was written fully — partial writes produce invalid JSON","Regenerate the mock file if produced by another tool"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e474e8803ce2ff5c2df09a58dab51d45f5c922ca","analyzedAt":"2026-09-03T12:38:19.024Z","contentChangedAt":"2026-09-03T12:38:19.024Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}