windmill-labs/windmill · error · Error

Failed to push queued jobs: ${e}

Error message

Failed to push queued jobs: ${e}

What it means

Generic wrapper error thrown by pushJobs when reading or importing the queued-jobs file fails for any reason other than a missing file (ENOENT, which is treated as 'nothing to push'). It rethrows the original error message embedded in `Failed to push queued jobs: ${e}`, so the underlying cause (parse error, permission error, API failure) is visible in the message text.

Source

Thrown at cli/src/commands/jobs/jobs.ts:241

    const queuedJobs = JSON.parse(queuedContent);

    if (!Array.isArray(queuedJobs)) {
      throw new Error("Queued jobs file must contain an array of jobs");
    }

    const queuedResult = await wmill.importQueuedJobs({
      workspace: ws.workspaceId,
      requestBody: queuedJobs,
    });

    log.info(colors.green(`Queued jobs: ${queuedResult}`));
  } catch (e: any) {
    if (e.code === "ENOENT") {
      log.info(
        colors.yellow(`No queued jobs file found at ${queuedPath}, skipping`)
      );
    } else {
      throw new Error(`Failed to push queued jobs: ${e}`);
    }
  }
}

const pull = new Command()
  .description("Pull completed and queued jobs from workspace")
  .option(
    "-c, --completed-output <file:string>",
    "Completed jobs output file (default: completed_jobs.json)"
  )
  .option(
    "-q, --queued-output <file:string>",
    "Queued jobs output file (default: queued_jobs.json)"
  )
  .option(
    "--skip-worker-check",
    "Skip checking for active workers before export"
  )

View on GitHub (pinned to e474e8803c)

Solutions

  1. Read the full message after the colon to identify the underlying cause (SyntaxError vs EACCES vs HTTP status).
  2. If it is a JSON parse error, validate the file with `jq . queued_jobs.json` and fix the syntax.
  3. If it is EACCES/EPERM, fix file permissions or run from a directory where queued_jobs.json is readable.
  4. If it is an HTTP error, check `wmill auth login` / WMILL_TOKEN validity and that the target workspace exists.

Example fix

// before: malformed file
[{"path": "f/a"},]

// after: valid JSON array
[{"path": "f/a"}]
Defensive patterns

Strategy: try-catch

Validate before calling

const content = await readTextFile(queuedPath).catch(() => null);
if (content !== null) JSON.parse(content); // throws early with a precise SyntaxError

Try / catch

try {
  await pushJobs(opts);
} catch (e: any) {
  const cause = String(e.message).replace("Failed to push queued jobs: ", "");
  if (/JSON/i.test(cause)) console.error("Fix JSON syntax in queued file:", cause);
  else if (/EACCES|EPERM/.test(cause)) console.error("Check file permissions:", cause);
  else if (/401|403/.test(cause)) console.error("Re-authenticate with `wmill auth login`");
  throw e;
}

Prevention

When it happens

Trigger: Running `wmill job push` when the queued file contains malformed JSON (JSON.parse throws SyntaxError), the file is not readable (EACCES), or `wmill.importQueuedJobs` rejects due to an HTTP/auth/API error.

Common situations: A truncated or hand-edited queued_jobs.json with a trailing comma or stray characters; a symlink to a file the current user cannot read; an expired or missing WMILL_TOKEN so the import API call returns 401/403; a workspace id that does not exist.

Related errors


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