windmill-labs/windmill · error

Could not read file ${p}

Error message

Could not read file ${p}

What it means

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.

Source

Thrown at cli/src/types.ts:313

  }
}

export function parseFromPath(p: string, content: string): any {
  return isWorkspaceDependencies(p)
    ? content
    : p.endsWith(".yaml")
      ? yamlParseContent(p, content)
      : p.endsWith(".json")
        ? JSON.parse(content)
        : content;
}
export function parseFromFile(p: string): any {
  if (p.endsWith(".json")) {
    return JSON.parse(readTextFileSync(p));
  } else if (p.endsWith(".yaml") || p.endsWith(".yml")) {
    return yamlParseContent(p, readTextFileSync(p));
  } else {
    throw new Error("Could not read file " + p);
  }
}
/**
 * Parse a `migrations/datatable/<datatable>/<timestamp>_<name>.(up|down).sql`
 * path into its parts. Returns undefined for any other path.
 */
export function parseDatatableMigrationPath(p: string):
  | { datatable: string; timestamp: number; name: string; kind: "up" | "down" }
  | undefined {
  const parts = p.split("/");
  if (
    parts[0] !== "migrations" ||
    parts[1] !== "datatable" ||
    parts.length !== 4
  )
    return undefined;
  const m = parts[3].match(/^(\d+)_(.*)\.(up|down)\.sql$/);
  if (!m) return undefined;

View on GitHub (pinned to e474e8803c)

Solutions

  1. Pass a .yaml, .yml, or .json file to the push/pull command.
  2. Convert the file to YAML or JSON if it uses another format.
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at cli/src/types.ts:313 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/fae5edd75e576c31. Report an issue: GitHub.