facebook/flow · error

Unsupported config option react.runtime={}

Error message

Unsupported config option react.runtime={}

What it means

When flow.js wasm builds its Options from a user-supplied config map, react.runtime is read as a string defaulting to 'automatic'; only 'classic' and 'automatic' map to ReactRuntime variants, and any other value panics. This guards the JSX transform mode: classic uses React.createElement, automatic uses the jsx runtime imports.

Source

Thrown at rust_port/crates/flow_dot_js_wasm/src/lib.rs:166

        "unused-promise",
    ] {
        if bool_config(config, lint, false) {
            if let Some(kinds) = LintKind::parse_from_str(lint) {
                for kind in kinds {
                    lint_severities.set_value(kind, (Severity::Err, None));
                }
            }
        }
    }

    let react_runtime = match config
        .get("react.runtime")
        .and_then(Value::as_str)
        .unwrap_or("automatic")
    {
        "classic" => ReactRuntime::Classic,
        "automatic" => ReactRuntime::Automatic,
        other => panic!("Unsupported config option react.runtime={}", other),
    };

    Options {
        all: true,
        assert_operator: if bool_config(config, "experimental.assert_operator", false) {
            AssertOperator::Enabled
        } else {
            AssertOperator::Disabled
        },
        babel_loose_array_spread: bool_config(config, "babel_loose_array_spread", false),
        component_syntax: true,
        enable_const_params: bool_config(config, "experimental.const_params", false),
        enable_pattern_matching: true,
        enable_records: true,
        enums: bool_config(config, "enums", true),
        hook_compatibility: true,
        lint_severities,
        max_header_tokens: 10,

View on GitHub (pinned to f88ac94bcf)

Solutions

  1. Set react.runtime to 'automatic' (default) or 'classic' — the only supported values
  2. Remove the react.runtime option entirely to get the 'automatic' default
  3. Check spelling and quoting of the value (must be the exact strings classic/automatic)
  4. If forwarding configs from other tools, map their JSX-transform names to these two values

Example fix

// before (config passed to flow.js wasm)
const config = { 'react.runtime': 'react-jsx' }; // panics: Unsupported config option react.runtime=react-jsx

// after
const config = { 'react.runtime': 'automatic' }; // or 'classic', or omit the key
Defensive patterns

Strategy: validation

Validate before calling

// validate before passing config into the flow.js wasm API
const VALID_REACT_RUNTIME = ['classic', 'automatic'];
function validateConfig(config) {
  const v = config['react.runtime'] ?? 'automatic';
  if (!VALID_REACT_RUNTIME.includes(v)) {
    throw new RangeError(`react.runtime must be one of ${VALID_REACT_RUNTIME.join('|')}, got ${JSON.stringify(v)}`);
  }
  return config;
}

Type guard

function isReactRuntimeValue(v) {
  return v === undefined || v === 'classic' || v === 'automatic';
}

Prevention

When it happens

Trigger: Passing a config object to the flow.js wasm API whose 'react.runtime' value is anything but 'classic' or 'automatic' — e.g. 'react-jsx', 'runtime', 'true', 'none', or a non-string JSON value coerced oddly. In .flowconfig terms, an unrecognized react.runtime= line surfaced through this path.

Common situations: Copying react.runtime values from Babel/eslint config vocabulary ('react-jsx', 'react-jsxdev', 'automatic-runtime') into flow's options; typos; booleans instead of strings; presets forwarding raw editor settings into flow.js.

Related errors


AI-assisted analysis of facebook/flow@f88ac94bcf (2026-08-20). Data as JSON: /api/errors/95c37fe3aca461e2. Report an issue: GitHub.