biomejs/biome · error

setter signatures are not supported in ErrorConstructor

Error message

setter signatures are not supported in ErrorConstructor

What it means

Build-time error thrown while lowering the ErrorConstructor (the `Error` constructor's static interface) type members. Setter signatures (e.g. `set stackTraceLimit(v: number)`) are not representable in the generated ErrorConstructorSignatures structure, so the lowering bails. The declaration must express static writable members as plain properties.

Source

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

                    let lowered = lower_error_constructor_property_member(&member)?;
                    if prototype.replace(lowered).is_some() {
                        bail!("ErrorConstructor has multiple prototype properties");
                    }
                }
                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,

View on GitHub (pinned to 3835945f06)

Solutions

  1. Replace the setter with a plain mutable property declaration in the ErrorConstructor source (accessor pair -> single property).
  2. Add TsSetterSignatureTypeMember support in the ErrorConstructor lowering arm if accessor members become required.

Example fix

// before
declare var Error: ErrorConstructor & {
  set captureStackTraceLimit(v: number);
}
// after
declare var Error: ErrorConstructor & {
  captureStackTraceLimit: number;
}
Defensive patterns

Strategy: validation

Validate before calling

// Reject setter members in ErrorConstructor sources before lowering
fn has_setter(source: &str) -> bool {
    source.lines().any(|l| l.trim().starts_with("set "))
}

Type guard

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

Prevention

When it happens

Trigger: Running the global-types codegen when the ErrorConstructor declaration contains a `set name(...) { ... }` setter signature member.

Common situations: Regenerating global types against a newer/alternative lib.es5.d.ts where static writable fields on ErrorConstructor are declared as get/set accessor pairs instead of properties.

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/d09814b752b9ce1b. Report an issue: GitHub.