oven-sh/bun · error · Error
finite can only be used on f64
Error message
finite can only be used on f64
What it means
Bindgen DSL guard: `.finite` was used on a type whose kind is not f64. Range/finite constraints only exist for double-precision floats in the C ABI layer, so applying it elsewhere is a definition error at codegen time.
Solutions
- Change the argument type to f64 if a finite constraint is needed
- Remove `.finite` for integer/other kinds — use validateInt32/enforceRange instead
- Re-run codegen after correcting the type chain
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at src/codegen/bindgen-lib-internal.ts:541 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/88ede10c2309fb79.
Report an issue: GitHub.
Appendix: source
Thrown at src/codegen/bindgen-lib-internal.ts:541
}
// Public interface definition API
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, {View on GitHub (pinned to 8c5296ac45)