windmill-labs/windmill · error
File already exists: ${filePath}
Error message
File already exists: ${filePath} What it means
Exists-check turned error in the folder command's scaffolder: stat() on f/{name}/folder.meta.yaml succeeded, meaning a local folder metadata file already occupies the name you asked newFolder to create. The input at fault is the requested folder name; the CLI refuses to overwrite an existing folder.meta.yaml. (The odd try/catch re-throw of its own error exists so the stat ENOENT path falls through to creation.)
Source
Thrown at cli/src/commands/folder/folder.ts:58
.padding(2)
.border(true)
.body(
folders.map((x) => [
x.name,
x.owners?.join(",") ?? "-",
JSON.stringify(x.extra_perms ?? {}),
])
)
.render();
}
}
async function newFolder(opts: GlobalOptions & { summary?: string }, name: string) {
const dirPath = `f${SEP}${name}`;
const filePath = `${dirPath}${SEP}folder.meta.yaml`;
try {
await stat(filePath);
throw new Error("File already exists: " + filePath);
} catch (e: any) {
if (e.message?.startsWith("File already exists")) throw e;
}
const template: FolderFile = {
summary: opts.summary ?? "",
display_name: name,
owners: [],
extra_perms: {},
};
await mkdir(dirPath, { recursive: true });
await writeFile(filePath, yamlStringify(template as Record<string, any>), {
flag: "wx",
encoding: "utf-8",
});
log.info(colors.green(`Created ${filePath}`));
}
async function get(opts: GlobalOptions & { json?: boolean }, name: string) {View on GitHub (pinned to e474e8803c)
Solutions
- Pick a different folder name for the new folder
- Edit the existing f/{name}/folder.meta.yaml directly if you meant to modify the folder
- Delete the existing local folder (and its server-side counterpart if intended) before recreating it
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at cli/src/commands/folder/folder.ts:58 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/fdc3d2302910a41d.
Report an issue: GitHub.