vectordotdev/vector · error

cue fmt exited with

Error message

cue fmt exited with {status}

What it means

`run_cue_fmt` shells out to the `cue` binary to format a generated CUE file and bails if the formatter exits non-zero. This means the cue toolchain is missing, crashed, or rejected the file path. The generated file may be left unformatted.

Solutions

  1. Check the cue toolchain: `cue version`; install or upgrade it (e.g. `go install cuelang.org/go/cmd/cue@latest`).
  2. Manually run `cue fmt <path>` on the generated file to see the exact formatter error.
  3. Inspect the generated CUE file for syntax problems if the formatter reports a parse error.
  4. Re-run the vdev release command after fixing.

Example fix

// before: cue missing/broken
$ vdev release generate-cue
cue fmt exited with exit status: 1
// after: install a working cue
$ go install cuelang.org/go/cmd/cue@latest
$ cue version && vdev release generate-cue
Defensive patterns

Strategy: try-catch

Validate before calling

command -v cue >/dev/null 2>&1 && cue version || echo "cue is not installed or broken"

Try / catch

if let Err(e) = result {
    if e.to_string().starts_with("cue fmt exited with") {
        eprintln!("cue toolchain problem: {e}; verify `cue version` and re-run `cue fmt <file>` manually");
    }
}

Prevention

When it happens

Trigger: `Command::new("cue").arg("fmt").arg(path).status()` returns a non-zero ExitStatus during `run` — e.g. the `cue` executable exists but fails on the target file (syntax error, permission issue on the path).

Common situations: An old or broken `cue` installation on PATH, a generated CUE file with invalid syntax handed to the formatter, or running in a container that lacks the cue binary.

Related errors


AI-assisted analysis of vectordotdev/vector@0d4ab78a4f (2026-09-16). Data as JSON: /api/errors/619e1f105c5de031. Report an issue: GitHub.

Appendix: source

Thrown at vdev/src/commands/release/generate_cue.rs:699

            if !e.pr_numbers.is_empty() {
                let json_prs = serde_json::to_string(&e.pr_numbers).unwrap();
                writeln!(s, "\t\t\tpr_numbers: {json_prs}").unwrap();
            }
            if !e.contributors.is_empty() {
                let json_contribs = serde_json::to_string(&e.contributors).unwrap();
                writeln!(s, "\t\t\tcontributors: {json_contribs}").unwrap();
            }
            s.push_str("\t\t}");
            s
        })
        .collect::<Vec<_>>()
        .join(",\n")
}

fn run_cue_fmt(path: &Path) -> Result<()> {
    let status = Command::new("cue").arg("fmt").arg(path).status()?;
    if !status.success() {
        bail!("cue fmt exited with {status}");
    }
    Ok(())
}

// ---------- Upgrade-guide (highlights) rendering ----------

/// Return the first file in `highlights_dir` whose name ends in the version-suffix used
/// by upgrade guides (e.g. `-0-58-0-upgrade-guide.md`), regardless of the date prefix.
fn find_existing_upgrade_guide(
    highlights_dir: &Path,
    version: &Version,
) -> Result<Option<PathBuf>> {
    if !highlights_dir.is_dir() {
        return Ok(None);
    }
    let suffix = format!(
        "-{}-{}-{}-upgrade-guide.md",
        version.major, version.minor, version.patch

View on GitHub (pinned to 0d4ab78a4f)