{"record":{"id":"645bf77482ae7ed8","repo":"windmill-labs/windmill","slug":"cannot-regenerate-lock-for-flow-remote-path-mi","errorCode":null,"errorMessage":"Cannot regenerate lock for flow ${remote_path}: missing inline script file(s): ${missingFiles.join(\", \")}. Either restore the file(s) or remove the !inline reference(s) from flow.yaml before retrying.","messagePattern":"Cannot regenerate lock for flow (.+?): missing inline script file\\(s\\): (.+?)\\. Either restore the file\\(s\\) or remove the !inline reference\\(s\\) from flow\\.yaml before retrying\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/src/commands/flow/flow_metadata.ts","lineNumber":293,"sourceCode":"      log,\n      folder + SEP!,\n      SEP,\n      locksToRemove,\n      missingFiles\n    );\n    if (flowValue.value.failure_module) {\n      await replaceInlineScripts([flowValue.value.failure_module], fileReader, log, folder + SEP!, SEP, locksToRemove, missingFiles);\n    }\n    if (flowValue.value.preprocessor_module) {\n      await replaceInlineScripts([flowValue.value.preprocessor_module], fileReader, log, folder + SEP!, SEP, locksToRemove, missingFiles);\n    }\n    if (missingFiles.length > 0) {\n      // Abort before updateFlow rather than push the literal `!inline path`\n      // string as rawscript.content (GIT-871 / #9140). Note: at this point\n      // replaceInlineScripts has already mutated `flowValue.value` in place\n      // for the modules that *did* resolve. All current callers re-throw on\n      // this error; do not catch and reuse `flowValue` without re-parsing.\n      throw new Error(\n        `Cannot regenerate lock for flow ${remote_path}: missing inline script file(s): ${missingFiles.join(\", \")}. ` +\n        `Either restore the file(s) or remove the !inline reference(s) from flow.yaml before retrying.`\n      );\n    }\n\n    //removeChangedLocks\n    const tempScriptRefs = tree?.getTempScriptRefs(folderNormalized);\n\n    // Preserve notes and groups — the backend round-trips through FlowValue\n    // which doesn't include these fields, so they'd be lost (#8641).\n    const savedNotes = flowValue.value.notes;\n    const savedGroups = flowValue.value.groups;\n\n    flowValue.value = await updateFlow(\n      workspace,\n      flowValue.value,\n      remote_path,\n      filteredDeps,","sourceCodeStart":275,"sourceCodeEnd":311,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/cli/src/commands/flow/flow_metadata.ts#L275-L311","documentation":"When regenerating a flow's lockfile, `!inline` script references are replaced with remote script content. If one or more referenced local files are missing on disk, the CLI aborts before calling updateFlow — otherwise the literal string '!inline path' would be pushed as rawscript.content (GIT-871 / #9140). Because replaceInlineScripts has already mutated flowValue.value in place for resolved modules, callers must re-parse rather than reuse it after this throw.","triggerScenarios":"Running `wmill flow generate-locks` (or push with lock regeneration) on a flow whose flow.yaml contains `!inline ./relative/path.ts` where the file was deleted, renamed, or is outside the expected working directory.","commonSituations":"Deleting a helper script from the repo without updating flow.yaml; running the CLI from a different working directory so relative paths don't resolve; partial checkouts in CI (sparse clone, submodule not initialized).","solutions":["Restore the missing file(s) listed in the error message at the referenced paths","Remove the `!inline` reference(s) from flow.yaml and point the module at a remote script path instead","Re-run the command from the flow's directory (or repo root) so relative paths resolve","In CI, ensure the checkout includes all files referenced by the flow"],"exampleFix":"// flow.yaml before\nvalue: !inline ./scripts/helper.ts   # file deleted\n// after (option A) restore scripts/helper.ts, or (option B)\nvalue:\n  path: u/admin/helper   # use a remote script instead of !inline","handlingStrategy":"validation","validationCode":"import { readFileSync, dirname } from 'node:fs';\nfor (const ref of inlineRefs(flowYaml)) {\n  const p = resolve(flowDir, ref);\n  if (!existsSync(p)) throw new Error(`missing inline file for ${ref}`);\n}","typeGuard":null,"tryCatchPattern":"try {\n  await generateLocks();\n} catch (e) {\n  if (String(e).includes('missing inline script file(s)')) {\n    // re-parse flow.yaml from disk; flowValue was mutated in place\n    const fresh = parseFlowYaml(await fsp.readFile('flow.yaml', 'utf8'));\n    // restore the missing files, then retry once\n  }\n}","preventionTips":["Never delete inline-referenced files without updating flow.yaml","Run the CLI from the flow directory so relative !inline paths resolve","Add a CI preflight that checks every !inline path exists","Avoid partial/sparse checkouts when deploying flows"],"tags":["cli","lockfile","missing-file","inline-script"],"backgroundTag":"missing-inline-script-file","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"}