biomejs/biome · error

Promise is missing {}

Error message

Promise is missing {}

What it means

The lowering compares the methods found on Promise/PromiseConstructor against a fixed PROMISE_METHOD_SPECIFICATIONS table (with PROMISE_METHOD_COUNT entries). If any required specification (identified by specification.global_name) was not observed on either the instance or static side, this error names the missing method and aborts.

Source

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

            PromiseMemberLocation::Static,
            &mut saw_methods,
        )?;
        for member in declaration.members() {
            if let AnyTsTypeMember::TsConstructSignatureTypeMember(member) = member {
                validate_promise_construct_signature(&member)?;
                saw_construct_signature = true;
            }
        }
    }
    if !saw_constructor_interface {
        bail!("PromiseConstructor must include an interface declaration");
    }
    if !saw_construct_signature {
        bail!("PromiseConstructor is missing a construct signature");
    }
    for (index, specification) in PROMISE_METHOD_SPECIFICATIONS.iter().enumerate() {
        if !saw_methods[index] {
            bail!("Promise is missing {}", specification.global_name);
        }
    }

    let members = std::iter::once(LoweredTypeMember {
        name: Text::from("constructor"),
        kind: LoweredMemberKind::Constructor,
        type_reference: LoweredTypeReference::Predefined("GLOBAL_PROMISE_CONSTRUCTOR_ID"),
    })
    .chain(PROMISE_METHOD_SPECIFICATIONS.map(promise_member))
    .collect();
    globals.push(LoweredGlobal {
        name: Text::from("Promise"),
        id_constant: "PROMISE_ID_GLOBAL_TYPE_ID",
        data: LoweredTypeData::Class(LoweredClass {
            name: Text::from("Promise"),
            type_parameters: Box::new([LoweredTypeReference::Predefined("GLOBAL_T_ID")]),
            members,
        }),

View on GitHub (pinned to 3835945f06)

Solutions

  1. Restore the missing method to the Promise interface or PromiseConstructor interface in the lib sources
  2. Update PROMISE_METHOD_SPECIFICATIONS / PROMISE_METHOD_COUNT in lower.rs if the required set intentionally changed
  3. Check target lib configuration (es2015 vs es2018 etc.) so the snapshot includes all required methods

Example fix

// before
interface Promise<T> { then(...): ...; }
// after
interface Promise<T> { then(...): ...; catch(...): ...; finally(...): ...; }
Defensive patterns

Strategy: validation

Validate before calling

const REQUIRED = ["then","catch","finally","resolve","reject","all","allSettled","any","race"];
const names = new Set([...promiseDecl.members, ...promiseConstructorDecl.members].map(m => m.name));
const missing = REQUIRED.filter(n => !names.has(n));
if (missing.length) throw new Error("Snapshot is missing Promise methods: " + missing.join(", "));

Prevention

When it happens

Trigger: Running generate_global_types when a required Promise method (e.g. then, catch, finally, resolve, reject, all, allSettled, any, race) is missing, optional, or renamed in the lib sources.

Common situations: A TypeScript lib version bump that removes or moves a method (e.g. finally living only in lib.es2018); a snapshot prune that dropped methods; an extension header (like bluebird-style helpers) altering the shape.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


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