ruvnet/ruflo · error · Error
@claude-flow/watermark/web: call `await init()` before use
Error message
@claude-flow/watermark/web: call `await init()` before use
What it means
assertReady() in the wasm-bindgen web wrapper found _ready false: init() was never awaited (or failed) before calling a watermark API. Sentinel guard — the WASM module instance is missing, so any tournament/gumbel scheme call would dereference uninitialized exports.
Source
Thrown at v3/@claude-flow/watermark/web/index.mjs:33
} from './ruflo_watermark.js';
let _ready = false;
/** Instantiate the WASM module. Await once before any other call. */
export async function init(input) {
if (_ready) return;
// Non-deprecated wasm-bindgen call shape; no arg => browser auto-fetch.
await initWasm(input === undefined ? undefined : { module_or_path: input });
_ready = true;
}
/** True once `init()` has completed. */
export function isReady() {
return _ready;
}
function assertReady() {
if (!_ready) throw new Error('@claude-flow/watermark/web: call `await init()` before use');
}
const SCHEMES = new Set(['tournament', 'tournament_nd', 'gumbel']);
const enc = new TextEncoder();
const toKeyBytes = (k) => (typeof k === 'string' ? enc.encode(k) : k);
const toU32 = (a) => (a instanceof Uint32Array ? a : Uint32Array.from(a));
const toF32 = (a) => (a instanceof Float32Array ? a : Float32Array.from(a));
function normScheme(s) {
const v = s || 'gumbel';
if (!SCHEMES.has(v)) throw new RangeError(`unknown scheme "${v}" (tournament | tournament_nd | gumbel)`);
return v;
}
function shape(r) {
const out = {
zScore: r.z_score,
pValue: r.p_value,
log10P: r.log10_p,
scoredPositions: r.scored_positions,View on GitHub (pinned to fa13ee4ad6)
Solutions
- Ensure the module/bridge/plugin initialize() method has been called and awaited before invoking this operation.
- Guard against calls made during startup: await the initialization promise or check the initialized flag and fail fast with a clear setup hint.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at v3/@claude-flow/watermark/web/index.mjs:33 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of ruvnet/ruflo@fa13ee4ad6 (2026-08-18).
Data as JSON: /api/errors/56b9237afb740cf4.
Report an issue: GitHub.