wavetermdev/waveterm · error

Rename failed: ${errorText}

Error message

Rename failed: ${errorText}

What it means

handleRename calls the FileMoveCommand RPC to rename a preview directory/file; if the RPC rejects, the error is stringified, logged as 'Rename failed: <e>' and shown to the user via an ErrorMsg. It reports a backend-side failure of the move/rename operation.

Source

Thrown at frontend/app/view/preview/preview-directory-utils.tsx:103

    model: PreviewModel,
    path: string,
    newPath: string,
    isDir: boolean,
    setErrorMsg: (msg: ErrorMsg) => void
) {
    fireAndForget(async () => {
        try {
            let srcuri = await model.formatRemoteUri(path, globalStore.get);
            if (isDir) {
                srcuri += "/";
            }
            await model.env.rpc.FileMoveCommand(TabRpcClient, {
                srcuri,
                desturi: await model.formatRemoteUri(newPath, globalStore.get),
            });
        } catch (e) {
            const errorText = `${e}`;
            console.warn(`Rename failed: ${errorText}`);
            const errorMsg: ErrorMsg = {
                status: "Rename Failed",
                text: `${e}`,
            };
            setErrorMsg(errorMsg);
        }
        model.refreshCallback();
    });
}

export function handleFileDelete(
    model: PreviewModel,
    path: string,
    recursive: boolean,
    setErrorMsg: (msg: ErrorMsg) => void
) {
    fireAndForget(async () => {
        const formattedPath = await model.formatRemoteUri(path, globalStore.get);

View on GitHub (pinned to a4447c1563)

Solutions

  1. Read the ErrorMsg text/status shown in the preview for the backend reason (e.g. permission denied, already exists)
  2. Verify the destination name is valid and does not already exist
  3. Confirm the source file still exists and refresh the preview
  4. Check filesystem/remote permissions and connectivity, then retry

Example fix

// before
const errorText = `${e}`;
console.warn(`Rename failed: ${errorText}`);
// after
const errorText = `${e}`;
console.warn(`Rename failed: ${errorText} (src=${srcuri})`);
if (errorText.includes("already exists")) {
    setErrorMsg({ status: "Rename Failed", text: "A file with that name already exists", level: "warning" });
    return;
}
Defensive patterns

Strategy: try-catch

Validate before calling

// before renaming, validate the target name client-side
const desturi = await model.formatRemoteUri(newPath, globalStore.get);
if (!newPath || newPath.includes('/') === false && await uriExists(desturi)) {
    setErrorMsg({ status: 'Rename Failed', text: 'Destination already exists' });
    return;
}

Type guard

function isFileSystemRpcError(e: unknown): e is { message?: string } {
    return e instanceof Error || (typeof e === 'object' && e !== null && 'message' in e);
}

Try / catch

try {
    await model.env.rpc.FileMoveCommand(TabRpcClient, { srcuri, desturi });
} catch (e) {
    const errorText = `${e}`;
    console.warn(`Rename failed: ${errorText}`);
    setErrorMsg({ status: 'Rename Failed', text: errorText });
}

Prevention

When it happens

Trigger: FileMoveCommand rejects: destination URI invalid or already exists, source missing, permission denied, or the backend/filesystem returns an error for srcuri -> desturi.

Common situations: Renaming to a name that collides with an existing file; renaming on a read-only or disconnected remote; stale preview state pointing at a deleted source; invalid characters in the new name.

Related errors


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