windmill-labs/windmill · error · LockfileGenerationError

Failed to generate lockfile: ${message}

Error message

Failed to generate lockfile: ${message}

What it means

The dependencies job ran to completion on the server but reported failure (completion.success is false). The CLI extracts the error message from the job result — result.error.message, or the stringified result itself — and wraps it in a LockfileGenerationError prefixed 'Failed to generate lockfile'. This means the server-side lockfile generation (e.g. pip/dbt dependency resolution) itself failed, not the transport.

Source

Thrown at cli/src/utils/metadata.ts:668

  let completion;
  try {
    completion = await pollJobWithQueueLogging(
      workspace.workspaceId,
      jobId,
      { label: `deps ${remotePath}` },
    );
  } catch (e: any) {
    throw new LockfileGenerationError(
      `Failed to poll dependencies job ${jobId}: ${e?.message ?? e}`
    );
  }

  const result = completion.result as any;
  if (!completion.success) {
    const message =
      result?.error?.message ??
      (typeof result === "string" ? result : JSON.stringify(result, null, 2));
    throw new LockfileGenerationError(`Failed to generate lockfile: ${message}`);
  }

  const lock = result?.lock;
  if (lock === undefined) {
    throw new LockfileGenerationError(
      `Failed to generate lockfile: ${JSON.stringify(result, null, 2)}`
    );
  }
  if (cacheKey) {
    lockCache.set(cacheKey, lock);
  }
  return lock;
}

async function updateScriptLock(
  workspace: Workspace,
  scriptContent: string,
  language: ScriptLanguage,

View on GitHub (pinned to e474e8803c)

Solutions

  1. Read the embedded message — it's the server-side error from the generation step and usually names the exact dependency or line that failed
  2. Fix the offending dependency in the script's metadata (raw_workspace_dependencies) or in the project file (requirements.txt, packages.yml, etc.)
  3. Verify private package indexes/registries are reachable from the worker and credentials (if any) are configured instance-side
  4. Confirm the language actually supports server-side lockfile generation for the dependency set you passed
  5. Retry after fixing; the result is deterministic for the same inputs

Example fix

// before: unresolvable dep in metadata
raw_workspace_dependencies: { "numpy": "numpy==9.9.9-nonexistent" }
// after: valid pinned version
raw_workspace_dependencies: { "numpy": "numpy==1.26.4" }
Defensive patterns

Strategy: try-catch

Validate before calling

// pre-flight: sanity-check declared dependencies locally before queuing the job
for (const [name, spec] of Object.entries(rawWorkspaceDependencies)) {
  if (!/^\S+==\S+$|^\S+$/.test(spec)) {
    throw new Error(`Suspicious dependency spec '${spec}' for ${name} — fix metadata before push`);
  }
}

Type guard

function jobFailedWithError(
  result: any,
): result is { error: { message: string } } {
  return (
    result != null &&
    typeof result === "object" &&
    typeof result.error?.message === "string"
  );
}

Try / catch

try {
  const lock = await fetchScriptLock(workspace, content, language, path, deps);
} catch (e) {
  if (e instanceof LockfileGenerationError && e.message.startsWith("Failed to generate lockfile:")) {
    // message contains the server-side resolver error; surface it verbatim
    log.error(`Dependency resolution failed on server:\n${e.message}`);
  } else throw e;
}

Prevention

When it happens

Trigger: The dependencies_async job finished with success=false. Its result usually carries { error: { message } } from the lockfile generation step: an unresolvable dependency, a bad raw_workspace_dependencies entry, a script language whose lockfile generation isn't supported, or an internal error in the generation code.

Common situations: A typo'd or nonexistent package version in raw workspace dependencies (pip can't resolve it); a requirements.txt/lockfile that contradicts the raw deps; dbt project with an invalid packages.yml or unreachable private registry; dependency job image lacking network access to a private PyPI/npm index.

Related errors


AI-assisted analysis of windmill-labs/windmill@e474e8803c (2026-09-03). Data as JSON: /api/errors/da4bae1b76b29fe6. Report an issue: GitHub.