{"record":{"id":"fae5edd75e576c31","repo":"windmill-labs/windmill","slug":"could-not-read-file-p","errorCode":null,"errorMessage":"Could not read file ${p}","messagePattern":"Could not read file (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/src/types.ts","lineNumber":313,"sourceCode":"  }\n}\n\nexport function parseFromPath(p: string, content: string): any {\n  return isWorkspaceDependencies(p)\n    ? content\n    : p.endsWith(\".yaml\")\n      ? yamlParseContent(p, content)\n      : p.endsWith(\".json\")\n        ? JSON.parse(content)\n        : content;\n}\nexport function parseFromFile(p: string): any {\n  if (p.endsWith(\".json\")) {\n    return JSON.parse(readTextFileSync(p));\n  } else if (p.endsWith(\".yaml\") || p.endsWith(\".yml\")) {\n    return yamlParseContent(p, readTextFileSync(p));\n  } else {\n    throw new Error(\"Could not read file \" + p);\n  }\n}\n/**\n * Parse a `migrations/datatable/<datatable>/<timestamp>_<name>.(up|down).sql`\n * path into its parts. Returns undefined for any other path.\n */\nexport function parseDatatableMigrationPath(p: string):\n  | { datatable: string; timestamp: number; name: string; kind: \"up\" | \"down\" }\n  | undefined {\n  const parts = p.split(\"/\");\n  if (\n    parts[0] !== \"migrations\" ||\n    parts[1] !== \"datatable\" ||\n    parts.length !== 4\n  )\n    return undefined;\n  const m = parts[3].match(/^(\\d+)_(.*)\\.(up|down)\\.sql$/);\n  if (!m) return undefined;","sourceCodeStart":295,"sourceCodeEnd":331,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/cli/src/types.ts#L295-L331","documentation":"parseFromFile only supports .json, .yaml and .yml; it was handed a path with another extension, so there is no parser for it and reading would produce unstructured text. The input at fault is the file path's extension.","triggerScenarios":"Thrown at cli/src/types.ts:313 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass a .yaml, .yml, or .json file to the push/pull command.","Convert the file to YAML or JSON if it uses another format."],"exampleFix":null,"handlingStrategy":"type-guard","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"}