Skip to content

oxo-flow validate#

Validate a .oxoflow workflow file. Checks TOML syntax, rule definitions, and DAG construction (including cycle detection).


Usage#

oxo-flow validate [OPTIONS] <WORKFLOW>

Arguments#

Argument Description
<WORKFLOW> Path to the .oxoflow workflow file

Options#

Option Short Description
--as-include — Validate as a sub-workflow fragment (skips input-existence checks, the pixi-manifest preflight, and DAG construction; cycle detection still applies)
--json — Output machine-readable JSON to stdout
--ai — Enable AI-powered semantic validation
--verbose -v Enable debug-level logging (global)
--quiet — Suppress informational output — the version banner is omitted; the ✓ verdict, warnings, errors, and --json output are unaffected (verified: output is byte-identical with --quiet) (global)
--no-color — Disable colored output, also respects the NO_COLOR environment variable (global)

Examples#

Validate a workflow#

oxo-flow validate pipeline.oxoflow

Output#

Valid workflow#

✓ pipeline.oxoflow — 5 rules, 4 dependencies

  ⚠ Warning: The following input files do not exist:
    - refs/genome.fa

--json prints the full result object (stdout):

{
  "command": "validate",
  "workflow": "pipeline.oxoflow",
  "valid": true,
  "rules": 5,
  "dependencies": 4,
  "errors": [],
  "warnings": [],
  "missing_inputs": ["refs/genome.fa"],
  "metadata": [],
  "metadata_digest": "sha256:4f2c…"
}

Invalid TOML syntax#

✗ pipeline.oxoflow — parse error in pipeline.oxoflow: TOML parse error at line 15, column 1

Circular dependency#

  error [E006]: DAG error: cycle detected in workflow DAG: align → sort_bam → align
    hint: check for circular dependencies between rules
✗ pipeline.oxoflow — DAG error: cycle detected in workflow DAG: align → sort_bam → align

Wildcard input without a sample domain#

An input containing a sample placeholder ({sample}, {group}, {pair_id}, …) resolves only when the workflow declares a sample domain ([[sample_groups]], [[pairs]], or sample_pattern). Without one the run fails mid-flight with a literal brace token, so validate reports the path as missing instead of approving it:

✓ wildin.oxoflow — 1 rule, 0 dependencies

  ⚠ Warning: The following input files do not exist:
    - {sample}.txt (no sample groups/pairs/sample_pattern declared)

--json includes the same entry in missing_inputs. That field is a free-text diagnostic list, not a stable machine interface: entries mix plain paths (file simply absent on disk) with paths annotated with a trailing (...) reason, so consumers must not exact-match the strings or split on whitespace — match on the path prefix instead.

Wildcard inputs with a declared sample domain#

When a sample domain is declared ([[sample_groups]], [[pairs]], or sample_pattern), validate binds every {sample}-class input through the same expansion and readiness pass dry-run and run use, then reports each concrete path that does not exist (and is not produced by another rule) in missing_inputs:

✓ wild.oxoflow — 1 rule, 0 dependencies

  ⚠ Warning: The following input files do not exist:
    - inputs/A.txt
    - inputs/B.txt

Exit stays 0 because missing inputs are warnings on the validate surface — the same contract as the literal-path case above. dry-run --json reports the identical list in its own missing_inputs field, so a CI gate can catch the unproducible input before run hard-fails on it.

Unbound wildcard and out-of-range input/output (W024/W034 surfaced in validate)#

A rule that uses a wildcard no rule in the workflow declares a source for (output = ["out/{sample}.txt"] with no [[sample_groups]], [[pairs]], sample_pattern, or [[values]] entry) keeps the brace token literal at run time in a shell or input path — and in an output path run rejects the rule before spawning. lint warns about this (W024); validate — the first gate in the recommended validate → dry-run → run path — now surfaces the same W024 diagnostic so a green validate no longer hides a workflow that cannot run. The wording follows the surface (output path = pre-spawn hard failure; input path or shell = literal text), and a wildcard name that matches a [config] key gets the likely-typo hint:

✓ p.oxoflow — 1 rule, 0 dependencies

  warning [W024]: wildcard '{outdir}' has no declared source — it appears in an output path, which `run` rejects before spawning (output paths can never keep a literal placeholder); declare the source or remove it (rule: probe)
    hint: declare a source for the wildcard (sample_pattern in [config], [[sample_groups]], [[pairs]], or a [[values]] table), or remove the placeholder. `outdir` is declared under [config] — did you mean `{config.outdir}`?

W034 is surfaced for the same runnability reason: an out-of-range {input[9]}/{output[9]} or a named key the rule does not declare renders as literal brace text and fails at the execution-time placeholder gate.

Warnings keep exit code 0 — only errors fail (the shared CLI exit-code contract is documented on run). validate scopes itself to W024, W034, SCI-AGG-RACE (runnability), and the data-inspecting advisories SCI-REF-NAMING / SCI-BAM-M5 / SCI-COUNTS-INT / SCI-DB-LOAD (local evidence; see below). The full best-practice sweep remains lint's job, and the warnings array carries only runnability warnings and the non-blocking data advisories. At run time the corresponding unbound-placeholder WARN is emitted once per (instance, placeholder): the multiple render sites within one instance (output pattern + command) collapse to a single line — the double-print the issue reporter saw — while each fan-out instance still logs its own line, because the message names the expanded instance (step1_lane_L1) rather than the template rule.

An engine-reserved placeholder the rule declares nothing for ({log}, {memory}, {chunks}) is stronger than these warnings: it is the E024 error described in the Notes below.

Metadata contract findings (META-*)#

When the workflow declares [workflow.metadata_schema] (or has a metadata_file table that violates a built-in rule such as duplicate ids), validate evaluates the contract and reports stable, row-level META-* findings — see the metadata contract reference for the full code table and field semantics. Without a declared schema the table is free-form: the built-in duplicate-id and pair-conflict findings are warnings, so a pre-upgrade workflow keeps validating green; the schema-driven checks do not run. Findings live in a dedicated metadata array in --json output (they are NOT duplicated in the errors / warnings arrays); the human surface prints exactly one line per finding:

  error [META-002]: required column 'batch' has no value for id 'S2'
    hint: fill in 'batch' for this row, or drop it from [workflow.metadata_schema] required_columns
✗ cohort.oxoflow — 1 validation error

Each finding carries code, severity (error / warning), row (1-based data row, null for table-level findings and inline [metadata] rows), column, id, message, and suggestion; the array is sorted by (code, row, column, id) so it is byte-stable across runs. Error findings set "valid": false and exit 1; warnings are reported and keep exit 0. The declaration is the strictness switch: with no [workflow.metadata_schema] every non-coverage finding is a warning; with one, it is an error. coverage additionally decides whether domain gaps (META-009 … META-011) are off, warnings (the default), or errors. The document also carries metadata_digest — the canonical digest of the contract plus effective rows (recorded by run in the checkpoint provenance; null when the workflow declares no metadata_file, no schema, and has no inline rows). --as-include skips the contract (a fragment does not own the parent's cohort table).

Aggregation race (SCI-AGG-RACE surfaced in validate)#

A rule that fans out across a sample, pair, [[values]], or output_pattern dimension while its declared outputs are not keyed by that dimension makes every expanded instance write the same concrete path — the instances race or duplicate work N−1 times. The shape is statically detectable (no expansion needed), and validate now reports it with the same detector and code dry-run uses, so the first gate no longer waves through a workflow that will crash or corrupt results at run time:

✓ agg.oxoflow — 1 rule, 0 dependencies

  warning [SCI-AGG-RACE]: rule fans out per the sample domain — no {sample}/{group} wildcard keys the outputs: … (rule: multiqc)
    hint: if the fan-out is unintentional … for a genuine per-element rule, key the outputs by that dimension's wildcard …

--json carries the same finding in warnings. The warning keeps exit code 0 — it identifies a design defect, not a parse/DAG error — and --as-include skips it because a standalone fragment does not declare the parent workflow's fan-out domains. dry-run still prints the full scientific-preflight sweep; among the static rules validate surfaces only this runnability-relevant code, plus the data-inspecting advisories below.

Data-inspecting advisories (SCI-REF-NAMING / SCI-BAM-M5 / SCI-COUNTS-INT / SCI-DB-LOAD)#

When the workflow is loaded from a file, validate also runs the four advisory data checks from the scientific preflight catalog:

  • SCI-REF-NAMING — a reference FASTA .fai and a BAM @SQ or VCF ##contig used by the same rule disagree on canonical chromosome spelling (chr1 vs 1).
  • SCI-BAM-M5 — a BAM header @SQ line's M5 checksum disagrees with the MD5 of the declared reference contig (the SAM/htslib samtools dict convention: uppercase bases after removing every byte outside printable ASCII, 0x21–0x7E), case-insensitively. Only contigs with a well-formed tag and a readable reference .fa + .fai are compared. The index offset passes a cheap ownership heuristic — it must be non-zero and the preceding byte must be a newline — which rejects a mid-line stale or hand-edited offset but cannot prove the offset starts a record (a line-aligned stale offset also follows a sequence-line newline). The check scans at most 256 MiB of reference bytes (bases plus line wrapping) and 8 million FASTA lines per contig, 512 MiB per analysis, and 64 contigs per pair, with at most 1 MiB buffered per line; everything past those caps is unknown.
  • SCI-COUNTS-INT — a .mtx input's real values sample as non-integral (a log-normalized matrix fed to a count-expecting tool).
  • SCI-DB-LOAD — a STAR genome index or Kraken2 database directory is larger than the rule's declared memory.

They read local evidence only: bounded header/metadata reads, the capped reference checksumming above, and a symlink-safe, entry-capped directory walk, with no network and no write. Evidence files are opened first and the open handle is checked (fstat) for a regular file; on Unix the open is non-blocking, so a FIFO cannot block. Windows named-pipe evidence reads are not covered by that non-blocking guard (the non-Unix open has no portable non-blocking flag, and Windows is source-compatible only in this repo); that residual is untested. Missing, placeholder-bearing, truncated, non-regular (FIFO/device), or malformed evidence yields no finding (unknown never fails), so a checkout without the data keeps today's validate output byte-identical; a rule whose static when is a context-free decided false is skipped like the static preflight (a wildcard/meta-dependent gate is evaluated, not skipped). Shell evidence is heuristic — a path merely echoed/commented/redirected is not consumed data — and evidence resolves relative to the workflow file's directory (the submit host for a cluster profile), not --workdir. Every finding is a warning with exit 0 — these checks are false-positive-prone by nature and are never contract-feedback blocking. --json carries them in the same warnings array; --as-include skips them because a fragment's relative evidence paths anchor to the fragment file, not the eventual host workflow.


Notes#

  • Exits with code 0 on success, 1 on failure
  • Validates TOML parsing, rule semantics, and DAG construction
  • Missing input files are reported as warnings (not errors). A rule's declared pixi manifest, by contrast, is existence-checked and reported as error E019 (a missing environment file blocks every rule that needs it at run time); --as-include skips input-existence checks, the pixi-manifest preflight, and DAG construction, but cycle detection still applies (cycles are semantic errors, not missing files)
  • [wildcard_constraints] entries are compiled with the same helper the expansion engine uses — an uncompilable pattern surfaces as error E020 (defense-in-depth for programmatically constructed configs; TOML-parsed workflows already fail at parse time with a config error)
  • input/output patterns carrying Snakemake-style inline wildcard constraints (e.g. {sample:[A-Z]+}) surface as error E021 — the engine's wildcard grammar is {name} only, so the brace group would stay literal text instead of expanding; move the regex into [wildcard_constraints]
  • a rule with no runnable command — shell missing/empty/whitespace-only and no non-empty script — surfaces as error E022. E002 cannot catch shell = "" because the field is present, yet the engine skips such a rule at run time; this gate is what makes an import that dropped a Nextflow script: block fail loudly instead of producing a workflow that validates and then does nothing. transform rules are exempt (their command lives in transform.map/transform.combine)
  • statically degenerate fan-out domains surface as error E023 instead of validating green and planning zero instances (or literal placeholders): an empty [[rules.scatter]] value domain or empty scatter variable, and a transform rule with an empty/missing split.by, no split source, a split.values_from resolving to an empty list, or a split.n that is zero, negative, non-integer, or above the 100,000-instance expansion cap. Data-dependent emptiness — a sample_pattern/split.glob matching zero files, or a config.<key> that a CLI --arg could still supply — stays a plan-time (run/dry-run) failure by design, so validate and lint remain usable without the data mounted. An empty [[sample_groups]] samples list is deliberately a WARNING (W042), not E023: the cohort can be supplied at run time with --samples @sheet.tsv, and validate takes no samples; run/dry-run still fail closed when no domain binds
  • an engine-reserved placeholder that can never be substituted on the surface where it appears surfaces as error E024: {log}/{log[0]} without log =, {log[N]} with N > 0 (only {log}/{log[0]} are rendered, even when log = is declared), {memory} without memory, {chunks} outside a transform combine shell, or a {values.<name>} reference no source can supply — not a declared [[values]] table, a pair/group metadata column or sample/group, an input_groups key, or a discovered output_pattern wildcard on a rule that actually consumes that producer (the namespaced form resolves those from the rule's fan-out combo). A scatter variable does not bind the namespaced form — the scatter pass expands only wildcard placeholders, so {values.<scatter_variable>} is E024 while the bare {scatter_variable} works. Likewise, envvars values, string parameter values, and the benchmark path never receive the values-namespace expansion, so {values.<name>} there is E024 even when a declared [[values]] table or fan-out binding supplies that name on the command surfaces (the executor expands only bare wildcard keys there). Unlike a bare {name}, which stays literal because it may be a legitimate shell brace program (e.g. awk '{print $1}'), the namespaced form is always engine syntax; it is flagged only when NO binding source exists, and --as-include skips that parent-dependent sub-class because a fragment may reference a binding declared by the host workflow. The non-expanded-surface variant (envvars/parameter/benchmark), like the reserved-token E024s, stays in force in a fragment: no host declaration can bind it. The scan covers the surfaces the execution-time gate actually inspects — shell, script path, hooks, log/benchmark, transform map/combine shells — plus envvars values, referenced string parameters, input patterns interpolated by {input}/{input[i]}/{input.<key>}, and output paths (never placeholder-rendered, so no declaration can fix them). when conditions are never flagged, and an input pattern is flagged only when a rendered command interpolates it. A fan-out wildcard named like a reserved token (scatter variable, [[sample_groups]] metadata column, [[pairs]] key, [[values]] table, sample/pairs-pattern capture) binds it during expansion and suppresses E024 — but only when EVERY combo the rule fans out over binds it: a metadata column declared on just some [[sample_groups]] or [[pairs]] entries is not exempt for the instances that lack it (the exemption follows the combos that actually materialize, including a per-rule when filter). run/dry-run apply the same detector as a plan-time gate before building the DAG. The strict_placeholders escape hatch still governs execution: [engine] strict_placeholders = false / OXO_FLOW_STRICT_PLACEHOLDERS=0 downgrades the plan-time gate to a warning and keeps the executor's gate warn-only — except for a bare reserved token in an output path, which the output-path gate rejects regardless, so the plan-time gate fails closed on those
  • a declared script file that does not exist at the resolved path surfaces as error E025. The candidate is the file the executor will actually run — the bare first token, or the script argument of an interpreter-led declaration (python scripts/x.py, bash scripts/x.sh, /usr/bin/env python scripts/x.py, including path-qualified and version-suffixed interpreter names such as /usr/bin/python3 and python3.11) — resolved relative to the workflow directory after {config.*} expansion. A dynamic token ($PWD/…, ~/…, quotes, a wildcard) and a form with no identifiable script file (python -m module) are skipped rather than guessed at, and a scratch = true rule is exempt because its relative script anchors to the run workdir; none of these can be judged from the workflow directory. A when gate that mentions a wildcard is not treated as statically skipped (its verdict is per-instance), matching lint W045. This is the same severity rationale as E019: a missing static script blocks the rule deterministically, and the engine only discovered it mid-run as an interpreter "can't open file" error. lint reports the same condition as warning W045; --as-include skips the check like E019/W020, and test --deep leaves it to the workdir-aware D001 deep check
  • Relative paths resolve against the workflow file's directory — the same base rules run from — so warnings are accurate even when invoked from another directory. This includes the pixi-manifest preflight: pixi = "envs/x.toml" is checked at <workflow dir>/envs/x.toml, never against the invoking CWD
  • Environments and tools are not verified here — the pixi-manifest check only confirms the manifest file exists, not that the pixi binary is installed or that the environment solves. Use oxo-flow test --deep (checks environment definition files D002 and PATH binaries D003) or oxo-flow env check for environment validation
  • Run validate before run to catch errors early without consuming compute resources
  • lint is a strict superset: it runs all validate checks plus style linting and secret scanning