oven-sh/bun · error · Error

This type already has finite set

Error message

This type already has finite set

What it means

Bindgen DSL guard: `.finite` was applied to a TypeImpl that already has the finite flag set. Double-application is treated as a definition mistake, since the flag is idempotent in effect but signals a duplicated chain.

Solutions

  1. Remove the duplicate `.finite` in the type chain
  2. Keep a single finite modifier per f64 type definition
  3. Re-run codegen to confirm the fix
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/codegen/bindgen-lib-internal.ts:544 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of oven-sh/bun@8c5296ac45 (2026-08-16). Data as JSON: /api/errors/dfcaa0bd443e9802. Report an issue: GitHub.

Appendix: source

Thrown at src/codegen/bindgen-lib-internal.ts:544

  get optional() {
    if (this.flags.required) {
      throw new Error("Cannot derive optional on a required type");
    }
    if (this.flags.default) {
      throw new Error("Cannot derive optional on a something with a default value (default implies optional)");
    }
    return new TypeImpl(this.kind, this.data, {
      ...this.flags,
      optional: true,
    });
  }

  get finite() {
    if (this.kind !== "f64") {
      throw new Error("finite can only be used on f64");
    }
    if (this.flags.finite) {
      throw new Error("This type already has finite set");
    }
    return new TypeImpl(this.kind, this.data, {
      ...this.flags,
      finite: true,
    });
  }

  get required() {
    if (this.flags.required) {
      throw new Error("This type already has required set");
    }
    if (this.flags.required) {
      throw new Error("Cannot derive required on an optional type");
    }
    return new TypeImpl(this.kind, this.data, {
      ...this.flags,
      required: true,
    });

View on GitHub (pinned to 8c5296ac45)