{"record":{"id":"e3d333d06bee3fd8","repo":"windmill-labs/windmill","slug":"using-local-pathscript-files-for-flow-preview-d","errorCode":null,"errorMessage":"Using local PathScript files for flow preview.\n${details.join(\"\\n\")}\nUse --remote to preview deployed workspace scripts instead.","messagePattern":"Using local PathScript files for flow preview\\.\n(.+?)\nUse --remote to preview deployed workspace scripts instead\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"cli/src/commands/flow/flow.ts","lineNumber":136,"sourceCode":"  }\n\n  const details: string[] = [];\n  if (divergence.changed.length > 0) {\n    details.push(\n      `These workspace scripts differ from the deployed version:\\n${divergence.changed\n        .map((path) => `- ${path}`)\n        .join(\"\\n\")}`\n    );\n  }\n  if (divergence.missing.length > 0) {\n    details.push(\n      `These scripts do not exist in the workspace yet:\\n${divergence.missing\n        .map((path) => `- ${path}`)\n        .join(\"\\n\")}`\n    );\n  }\n\n  log.warn(\n    `Using local PathScript files for flow preview.\\n${details.join(\"\\n\")}\\nUse --remote to preview deployed workspace scripts instead.`\n  );\n}\n\nconst alreadySynced: string[] = [];\n\n// Collect every script/sub-flow step path in a flow value — recursively through loops,\n// branches, and the failure/preprocessor modules — for workspace-path validation. Unlike\n// `collectPathScriptPaths` this also includes `type: \"flow\"` sub-flow steps.\nfunction collectStepPaths(flowValue: any): string[] {\n  const paths: string[] = [];\n  const walk = (modules: any[] | undefined) => {\n    for (const m of modules ?? []) {\n      const v = m?.value;\n      if (!v) continue;\n      if ((v.type === \"script\" || v.type === \"flow\") && typeof v.path === \"string\") {\n        paths.push(v.path);\n      }","sourceCodeStart":118,"sourceCodeEnd":154,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/cli/src/commands/flow/flow.ts#L118-L154","documentation":"`warnAboutLocalPathScriptDivergence`, called during flow preview, tells the developer that flow preview is using locally edited PathScript files rather than the versions deployed in the workspace. It lists which scripts diverged (including ones missing from the workspace) and points to `--remote` to preview the deployed versions instead.","triggerScenarios":"Running `wmill flow preview` (or `flow run --preview`) on a flow whose locked PathScript dependencies differ from workspace content — locally edited files, or scripts referenced by path that were never pushed (missing from the workspace), without the `--remote` flag.","commonSituations":"Developer edited a PathScript locally after the flow lock was generated; teammate pushed scripts the local checkout lacks; fresh clone where the flow is synced but its scripts were never synced; previewing before running `wmill sync push`.","solutions":["Push the local scripts so workspace matches local: `wmill script push` / `wmill sync push`.","Preview deployed content instead: add `--remote` to the flow preview command.","Regenerate the flow lock after syncing: `wmill flow generate-lock` (or `wmill generate-metadata`) to reconcile paths.","Create the missing scripts in the workspace if they are genuinely absent."],"exampleFix":"// before: preview diverges silently from deployed\nwmill flow preview my.flow.yaml\n// after: preview exactly what is deployed\nwmill flow preview my.flow.yaml --remote","handlingStrategy":"validation","validationCode":"// before previewing, verify the referenced scripts exist in the workspace\nimport * as wmill from 'windmill-client';\nfor (const path of localPathScriptPaths) {\n  try { await wmill.getScriptByPath(path); }\n  catch { console.warn(`missing in workspace: ${path} — push it first`); }\n}","typeGuard":"null","tryCatchPattern":"null","preventionTips":["Run `wmill sync push` before `wmill flow preview` after local edits.","Use `--remote` whenever you intend to preview deployed behavior.","Regenerate locks (`wmill generate-metadata`) after adding or moving PathScripts."],"tags":["cli","flow-preview","path-script","sync-divergence"],"backgroundTag":"local-workspace-divergence","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"}