biomejs/biome · error

metavariables are not supported in ErrorConstructor

Error message

metavariables are not supported in ErrorConstructor

What it means

Build-time error from the ErrorConstructor lowering in xtask/codegen. A member of the ErrorConstructor declaration parsed as JsMetavariable (incomplete/unparsed syntax), which cannot be converted into a constructor signature entry, so the generator aborts via bail!.

Source

Thrown at xtask/codegen/src/generate_global_types/lower.rs:2677

                    }
                }
                AnyTsTypeMember::TsMethodSignatureTypeMember(_) => {
                    bail!("method signatures are not supported in ErrorConstructor")
                }
                AnyTsTypeMember::JsBogusMember(_) => {
                    bail!("bogus members are not supported in ErrorConstructor")
                }
                AnyTsTypeMember::TsGetterSignatureTypeMember(_) => {
                    bail!("getter signatures are not supported in ErrorConstructor")
                }
                AnyTsTypeMember::TsIndexSignatureTypeMember(_) => {
                    bail!("index signatures are not supported in ErrorConstructor")
                }
                AnyTsTypeMember::TsSetterSignatureTypeMember(_) => {
                    bail!("setter signatures are not supported in ErrorConstructor")
                }
                AnyTsTypeMember::JsMetavariable(_) => {
                    bail!("metavariables are not supported in ErrorConstructor")
                }
            }
        }
    }

    Ok(ErrorConstructorSignatures {
        constructor: constructor.context("ErrorConstructor is missing a construct signature")?,
        call: call.context("ErrorConstructor is missing a call signature")?,
        prototype,
    })
}

/// Lowers supported `ErrorConstructor` static properties.
fn lower_error_constructor_property_member(
    property: &TsPropertySignatureTypeMember,
) -> Result<LoweredTypeMember> {
    let name = lower_object_member_name(property.name()?)?;
    if name.text() != "prototype" {

View on GitHub (pinned to 3835945f06)

Solutions

  1. Repair the ErrorConstructor declaration so all members are syntactically complete.
  2. Re-run generation with the current grammar (`just gen-grammar typescript` then the codegen) so members parse concretely.
  3. Handle JsMetavariable explicitly in the ErrorConstructor match if it becomes an expected input.

Example fix

// before (incomplete member)
interface ErrorConstructor {
  captureStackTrace
// after
interface ErrorConstructor {
  captureStackTrace(targetObject: object, constructorOpt?: Function): void;
}
Defensive patterns

Strategy: validation

Validate before calling

// Fail fast if the ErrorConstructor source still contains conflict markers or truncation
fn source_is_complete(source: &str) -> Result<(), String> {
    if source.contains("<<<<<<<") || source.contains(">>>>>>>") {
        return Err("merge conflict markers in ErrorConstructor source".into());
    }
    Ok(())
}

Type guard

fn is_concrete_ctor_member(m: &AnyTsTypeMember) -> bool {
    !matches!(m, AnyTsTypeMember::JsMetavariable(_))
}

Prevention

When it happens

Trigger: Running the global-types codegen when any member inside the ErrorConstructor type contains malformed or incomplete syntax that the TypeScript parser recovers as a metavariable.

Common situations: A truncated lib.d.ts input, a merge conflict marker left in the bundled type source, or a grammar change causing previously valid members to parse incompletely.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of biomejs/biome@3835945f06 (2026-09-13). Data as JSON: /api/errors/599dd5fa2eef2844. Report an issue: GitHub.