swc-project/swc · error

flow strip verification failed

Error message

flow strip verification failed

What it means

After the Flow strip pass, every collected file is re-verified (parse and comparison stages); each failure is recorded with path, stage and message into a failures list, which the command prints before bailing with this aggregate error. The bail just means 'one or more files failed'; the printed table above it is the actual diagnosis. Causes are either unsupported Flow syntax for the enabled flags or a genuine bug in the strip transforms.

Source

Thrown at crates/dbg-swc/src/es/flow/strip.rs:85

        let total = files.len();
        let failed = failures.len();
        let passed = total - failed;

        println!("Checked {total} files: {passed} passed, {failed} failed");

        if !failures.is_empty() {
            println!("Failures:");
            for failure in failures {
                println!(
                    "{} [{}] {}",
                    failure.path.display(),
                    failure.stage,
                    failure.message
                );
            }

            bail!("flow strip verification failed");
        }

        Ok(())
    }

    fn flow_syntax(&self) -> FlowSyntax {
        FlowSyntax {
            jsx: self.jsx,
            all: self.all,
            require_directive: self.require_directive,
            enums: self.enums,
            decorators: self.decorators,
            components: self.components,
            pattern_matching: self.pattern_matching,
        }
    }
}

View on GitHub (pinned to 5176682b65)

Solutions

  1. Read the printed failure table and take the first listed file
  2. Enable the syntax flags matching your corpus: --jsx, --enums, --decorators, --components, --pattern-matching (or --all) and re-run
  3. Minimize the failing file and re-run to confirm the trigger; if it is valid Flow, report it to the SWC repo with the repro and the failure stage

Example fix

# before
$ dbg-swc es flow strip --path ./fixtures   # corpus uses Flow enums
# after - enable the syntax the stripper must accept
$ dbg-swc es flow strip --path ./fixtures --enums --decorators
Defensive patterns

Strategy: try-catch

Validate before calling

# smoke-check the corpus with the flags you intend to use before the full run
find "$TARGET" -type f \( -name '*.js' -o -name '*.jsx' \) -print0 |
  xargs -0 -n1 dbg-swc es flow strip --all --dry-run 2>&1 | tee /tmp/strip-preflight.log || {
    echo 'preflight found failing files - see log' >&2; exit 2; }
# run the real verification only when the preflight is clean

Try / catch

match cmd.run(cm) {
    Ok(()) => {}
    Err(e) if format!("{e:#}").contains("flow strip verification failed") => {
        // failures were already printed with path/stage/message;
        // capture them into a report instead of aborting the whole batch
        write_report("/tmp/flow-strip-failures.md")?;
        return Err(e);
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: Running the strip verification where at least one file fails parse or verification: Flow features not covered by the passed flags (enums, decorators, JSX, component syntax, pattern matching) or a transform regression in swc's Flow stripper.

Common situations: Running with default flags on codebases that use Flow enums or decorators; newer Flow syntax the stripper has not learned; local modifications to the Flow fixtures that are themselves invalid.

Related errors


AI-assisted analysis of swc-project/swc@5176682b65 (2026-08-17). Data as JSON: /api/errors/7e68055d33f3b1f0. Report an issue: GitHub.