wavetermdev/waveterm · error

call ${methodName} error: ${respData.error}

Error message

call ${methodName} error: ${respData.error}

What it means

The backend call succeeded at the HTTP layer and returned valid JSON, but the WebReturnType payload carried an error field — an application-level error from the backend service handler (e.g. the requested object doesn't exist or the operation was refused). callBackendService re-throws it as a client-side Error prefixed with the method name.

Source

Thrown at frontend/app/store/wos.ts:140

        method: "POST",
        body: JSON.stringify(waveCall),
    });
    const prtn = fetchPromise
        .then((resp) => {
            if (!resp.ok) {
                throw new Error(`call ${methodName} failed: ${resp.status} ${resp.statusText}`);
            }
            return resp.json();
        })
        .then((respData: WebReturnType) => {
            if (respData == null) {
                return null;
            }
            if (respData.updates != null) {
                updateWaveObjects(respData.updates);
            }
            if (respData.error != null) {
                throw new Error(`call ${methodName} error: ${respData.error}`);
            }
            const durationStr = Date.now() - startTs + "ms";
            debugLogBackendCall(methodName, durationStr, args);
            return respData.data;
        });
    return prtn;
}

const waveObjectValueCache = new Map<string, WaveObjectValue<any>>();

function reloadWaveObject<T extends WaveObj>(oref: string): Promise<T> {
    let wov = waveObjectValueCache.get(oref);
    if (wov === undefined) {
        wov = getWaveObjectValue<T>(oref, true);
        return wov.pendingPromise;
    }
    const prtn = GetObject<T>(oref);
    prtn.then((val) => {

View on GitHub (pinned to a4447c1563)

Solutions

  1. Read the message after the prefix — it contains the backend's own error text identifying the failing condition
  2. Validate object ids / arguments before the call (existence checks, correct types)
  3. Refresh frontend state if the object was deleted server-side
  4. Check waveserver logs at the same timestamp for the handler's stack trace
  5. Align frontend/backend versions if argument-shape mismatches appear after an upgrade

Example fix

// before
const obj = await rpcService.Call(ctx, "waveobj", "GetObject", otype, oid);
// after
let obj = null;
try {
    obj = await rpcService.Call(ctx, "waveobj", "GetObject", otype, oid);
} catch (e) {
    if (String(e).includes("waveobj.GetObject error")) {
        console.warn("object unavailable:", e.message);
        await refreshObjStore();
    } else {
        throw e;
    }
}
Defensive patterns

Strategy: try-catch

Validate before calling

if (!oid || typeof oid !== "string") {
    throw new Error("GetObject requires a valid oid");
}
// optionally check object existence from local cache first

Type guard

function isBackendServiceError(err: unknown): err is Error {
    return err instanceof Error && /call .* error: /.test(err.message);
}

Try / catch

try {
    const obj = await rpcService.Call(ctx, "waveobj", "GetObject", otype, oid);
} catch (e) {
    if (isBackendServiceError(e)) {
        console.error("backend rejected call:", e.message.replace(/^call \S+ error: /, ""));
        await refreshObjStore();
        return null;
    }
    throw e;
}

Prevention

When it happens

Trigger: Any waveobj service call whose handler returns {error: "..."}: GetObject on a nonexistent oid, invalid arguments to a service method, backend business-rule rejection (permissions, state conflicts).

Common situations: Referencing a deleted waveobj (stale oid in frontend state); calling a service method with wrong argument shape/type; server-side validation rejecting the request; version mismatch where frontend sends args a new backend rejects.

Related errors


AI-assisted analysis of wavetermdev/waveterm@a4447c1563 (2026-09-01). Data as JSON: /api/errors/adfacfc92cf82194. Report an issue: GitHub.