{"record":{"id":"f1a318bd7944c162","repo":"windmill-labs/windmill","slug":"not-a-flow","errorCode":null,"errorMessage":"not a flow","messagePattern":"not a flow","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/src/commands/dev/dev.ts","lineNumber":466,"sourceCode":"  };\n\n  // Load a resource by its windmill path (e.g., \"u/admin/my_script\" or \"f/my_flow\")\n  async function loadWmPath(wmPath: string): Promise<LastEditScript | LastEditFlow | undefined> {\n    wmPath = normalizeWmPath(wmPath);\n    // Try as flow — check both dotted and non-dotted suffixes\n    let flowDir: string | undefined;\n    let flowYaml: string | undefined;\n    for (const suffix of [\".flow\", \"__flow\"]) {\n      const candidate = wmPath + suffix + \"/\";\n      try {\n        await access(candidate + \"flow.yaml\");\n        flowDir = candidate;\n        flowYaml = candidate + \"flow.yaml\";\n        break;\n      } catch {}\n    }\n    try {\n      if (!flowDir || !flowYaml) throw new Error(\"not a flow\");\n      const localFlow = (await yamlParseFile(flowYaml)) as FlowFile;\n      await replaceInlineScripts(\n        localFlow.value.modules,\n        async (p: string) => await readTextFile(flowDir + p),\n        log,\n        flowDir,\n        SEP,\n        undefined,\n      );\n      snapshotPathScripts(localFlow.value);\n      const localScriptReader = createPreviewLocalScriptReader({\n        exts,\n        defaultTs: opts.defaultTs,\n        codebases,\n      });\n      await replaceAllPathScriptsWithLocal(localFlow.value, localScriptReader, log);\n      tagReplacedPathScripts(localFlow.value);\n      const edit: LastEditFlow = {","sourceCodeStart":448,"sourceCodeEnd":484,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/cli/src/commands/dev/dev.ts#L448-L484","documentation":"During `wmill app dev`/`flow dev` setup, `loadWmPath` probes candidate directories for a flow directory and its flow.yaml. If after all probes neither `flowDir` nor `flowYaml` was resolved, it throws 'not a flow' — meaning the current directory layout does not correspond to a pulled/checked-out Windmill flow, so dev mode cannot load it.","triggerScenarios":"Running `wmill dev`/flow dev commands in a directory that isn't a flow checkout: no flow.yaml found at the expected locations, running in a script or app directory instead of a flow directory, or the flow.yaml sits deeper than the probed candidates.","commonSituations":"Running the dev command from the repo root instead of the flow folder; directory renamed after pulling; flow pulled with an older CLI storing a different layout; mixing up script dev and flow dev commands.","solutions":["cd into the flow directory that contains flow.yaml (or its parent the probe expects).","Re-pull the flow with `wmill flow pull` to recreate the expected layout.","Verify you're using the right dev command for the asset type (flow vs script vs app)."],"exampleFix":"// before\nwmill dev   # run in repo root\n// after\ncd flows/my_flow && wmill dev","handlingStrategy":"validation","validationCode":"import { existsSync } from 'node:fs';\nif (!existsSync('flow.yaml')) throw new Error('not in a flow directory: flow.yaml not found in ' + process.cwd());","typeGuard":"null","tryCatchPattern":"try { await dev() } catch (e) { if (e.message === 'not a flow') console.error('cd into a directory containing flow.yaml first'); else throw e; }","preventionTips":["Always run dev commands from the pulled flow directory","Re-pull with `wmill flow pull` if the layout is uncertain","Confirm flow.yaml exists before scripting dev commands","Use separate directories for scripts vs flows"],"tags":["cli","dev-workflow","flow","directory-layout"],"backgroundTag":"missing-project-context","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"}