{"record":{"id":"466fde866e079159","repo":"windmill-labs/windmill","slug":"failed-to-upload-scripts-to-temp-storage-backend","errorCode":null,"errorMessage":"Failed to upload scripts to temp storage (backend may be too old): ${e}. Locks will be generated using deployed script versions only — locally modified relative imports may not be reflected.","messagePattern":"Failed to upload scripts to temp storage \\(backend may be too old\\): (.+?)\\. Locks will be generated using deployed script versions only — locally modified relative imports may not be reflected\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"cli/src/commands/generate-metadata/generate-metadata.ts","lineNumber":563,"sourceCode":"        workspace,\n        opts,\n        false,\n        true, // noStaleMessage\n        tree\n      );\n    }\n  }\n\n  // === Propagate staleness through imports ===\n  tree.propagateStaleness();\n\n  // Upload stale scripts to temp storage so the backend can resolve relative imports.\n  // If this fails (e.g. backend is older and doesn't have /raw_temp endpoints),\n  // degrade gracefully: locks will be generated using deployed script content only.\n  try {\n    await uploadScripts(tree, workspace);\n  } catch (e) {\n    log.warn(colors.yellow(\n      `Failed to upload scripts to temp storage (backend may be too old): ${e}. ` +\n      `Locks will be generated using deployed script versions only — locally modified ` +\n      `relative imports may not be reflected.`\n    ));\n  }\n\n  // === Populate staleItems from tree ===\n  const staleItems: StaleItem[] = [];\n  const seenFolders = new Set<string>();\n\n  for (const p of tree.allPaths()) {\n    const staleReason = tree.getStaleReason(p);\n    if (!staleReason) continue;\n\n    const itemType = tree.getItemType(p)!;\n    const itemFolder = tree.getFolder(p)!;\n\n    if (itemType === \"dependencies\") {","sourceCodeStart":545,"sourceCodeEnd":581,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/cli/src/commands/generate-metadata/generate-metadata.ts#L545-L581","documentation":"`generateMetadata` uploads scripts to temp storage so the backend can resolve relative imports when generating locks. If the upload fails (classically because the backend lacks the `/raw_temp` endpoints), it warns and continues, generating locks from deployed script content only — locally modified relative imports will not be reflected.","triggerScenarios":"Running `wmill generate-metadata` (or flow lock regeneration) on a project with scripts that have local relative-import modifications when `uploadScripts` throws: old backend without `/raw_temp`, network error, or auth failure.","commonSituations":"Outdated self-hosted backend; offline development; CI runner with restricted network access; token revoked mid-run.","solutions":["Upgrade the Windmill backend so `/raw_temp` upload endpoints exist.","Push locally modified imported scripts first (`wmill sync push`) so deployed content already matches.","Verify connectivity/credentials with `wmill workspace show`, then rerun `wmill generate-metadata`.","Accept the degraded output only if your imports are unchanged locally."],"exampleFix":"// before: locks generated from deployed imports, local edits lost\nwmill generate-metadata\n// after: ensure local edits are in the workspace first\nwmill sync push && wmill generate-metadata","handlingStrategy":"fallback","validationCode":"// ensure deployed content matches local before generating metadata\nconst res = await fetch(`${baseUrl}/api/w/${workspaceId}/scripts/raw_script_temp`, { method: 'HEAD', headers: { Authorization: token } });\nif (res.status === 404) { await wmill.syncPush(); } // old backend: sync instead of temp-upload","typeGuard":"null","tryCatchPattern":"try {\n  await wmill.generateMetadata({});\n} catch (e: any) {\n  if (/temp storage|backend may be too old/.test(e.message ?? '')) {\n    await wmill.syncPush();\n    await wmill.generateMetadata({});\n  } else { throw e; }\n}","preventionTips":["Upgrade the backend to support `/raw_temp` endpoints.","Run `wmill sync push` before generating metadata when local imports were edited.","Diff generated locks after generation to confirm local imports were honored."],"tags":["cli","backend-version","relative-imports","graceful-degradation"],"backgroundTag":"backend-too-old","analyzedSha":"e474e8803ce2ff5c2df09a58dab51d45f5c922ca","analyzedAt":"2026-09-03T12:38:19.024Z","contentChangedAt":"2026-09-03T12:38:19.024Z","schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}