biomejs/biome · error

Promise global value side references missing PromiseConstruc

Error message

Promise global value side references missing PromiseConstructor group

What it means

The Promise value declaration (`declare var Promise: PromiseConstructor`) references the PromiseConstructor type, so lowering requires a corresponding 'PromiseConstructor' global group. When the manifest has no such group, the reference cannot be resolved and codegen fails with this message.

Source

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

                format!(
                    "failed to find interface declaration {} at {:?}",
                    record.declared_name.text(),
                    record.text_range
                )
            })?;
        validate_promise_interface(&declaration)?;
        validate_promise_methods(
            &declaration,
            PromiseMemberLocation::Instance,
            &mut saw_methods,
        )?;
    }
    if !saw_promise_interface {
        bail!("Promise global must include an interface declaration");
    }

    let Some(constructor_group) = manifest.global_group("PromiseConstructor") else {
        bail!("Promise global value side references missing PromiseConstructor group");
    };
    if !constructor_group.has_role(GlobalDeclarationRole::Type) {
        bail!("PromiseConstructor must have a type-side declaration");
    }

    let mut saw_constructor_interface = false;
    let mut saw_construct_signature = false;
    for record in constructor_group.declarations() {
        match &record.kind {
            DeclarationKind::Interface => saw_constructor_interface = true,
            DeclarationKind::TypeAlias => {
                bail!("type aliases are not supported in PromiseConstructor")
            }
            DeclarationKind::DeclareFunction
            | DeclarationKind::VariableDeclarator { .. }
            | DeclarationKind::ImportEquals => {
                bail!("value-side PromiseConstructor declarations are not supported")
            }

View on GitHub (pinned to 3835945f06)

Solutions

  1. Add or restore the PromiseConstructor declarations (the `interface PromiseConstructor` with construct signature, then, catch, finally) to the global typings source.
  2. Confirm the group name is exactly "PromiseConstructor" in the manifest and grouping logic.
  3. Regenerate and re-run `cargo xtask codegen`.
Defensive patterns

Strategy: fallback

Validate before calling

// Verify the referenced group exists before lowering
fn group_exists(manifest: &Manifest, name: &str) -> bool {
  manifest.global_group(name).is_some()
}
if !group_exists(&manifest, "PromiseConstructor") {
  bail!("Promise value side references missing PromiseConstructor group");
}

Try / catch

match lower_promise_globals(&manifest, &mut globals, &source_cache) {
  Err(e) if e.to_string().contains("missing PromiseConstructor group") => {
    eprintln!("Restore the `interface PromiseConstructor` declarations and rerun `cargo xtask codegen`");
    std::process::exit(1);
  }
  r => r?,
}

Prevention

When it happens

Trigger: Running `cargo xtask codegen` when manifest.global_group("PromiseConstructor") returns None — the PromiseConstructor declarations are absent from the manifest, were renamed, or were not grouped under that name.

Common situations: Removing or renaming the `interface PromiseConstructor` block in the global typings; a grouping/parsing change stops associating PromiseConstructor declarations with that group name; partially copied global declaration files.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


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