{"record":{"id":"1eb621fc61923a2e","repo":"windmill-labs/windmill","slug":"file-path-must-refer-to-a-file-1eb621","errorCode":null,"errorMessage":"file path must refer to a file.","messagePattern":"file path must refer to a file\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/src/commands/script/script.ts","lineNumber":186,"sourceCode":"async function push(opts: PushOptions, filePath: string) {\n  opts = await mergeConfigWithConfigFile(opts);\n  const workspace = await resolveWorkspace(opts);\n\n  if (!validatePath(filePath)) {\n    return;\n  }\n\n  // A dbt project's descriptor is optional, so the one content path a\n  // descriptor-less project has is deliberately not on disk. The project beside\n  // it is what says the script is real.\n  const absentDescriptor = await stat(filePath).then(\n    () => false,\n    (e) => isMissingDbtDescriptor(filePath, e)\n  );\n  if (!absentDescriptor) {\n    const fstat = await stat(filePath);\n    if (!fstat.isFile()) {\n      throw new Error(\"file path must refer to a file.\");\n    }\n  }\n\n  if (filePath.endsWith(\".script.json\") || filePath.endsWith(\".script.yaml\")) {\n    throw Error(\n      \"Cannot push a script metadata file, point to the script content file instead (.py, .ts, .go|.sh)\"\n    );\n  }\n\n  if (isFileResource(filePath) || isFilesetResource(filePath)) {\n    throw Error(\n      \"Cannot push a file/fileset resource content file as a script, push its .resource.yaml with 'wmill resource push' instead\"\n    );\n  }\n\n  await requireLogin(opts);\n\n  // Warn about metadata state before pushing","sourceCodeStart":168,"sourceCodeEnd":204,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/cli/src/commands/script/script.ts#L168-L204","documentation":"Fired by `wmill script push` when the local path given for the script does not pass validatePath's check that the path refers to an existing regular file. This is a generic validation guard: the faulting input is the CLI filePath argument, which typically points to a directory, a glob, or a nonexistent location instead of the script's YAML/TS file. The command exits early (returns, not throws) after printing the validation message.","triggerScenarios":"Thrown at cli/src/commands/script/script.ts:186 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass the script file (e.g. script.ts or script.yaml), not a directory.","For folder pushes use `wmill sync push` / `wmill script push --all` instead of pointing at the folder."],"exampleFix":null,"handlingStrategy":"validation","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"}