wavetermdev/waveterm · error

Delete failed: ${errorText}

Error message

Delete failed: ${errorText}

What it means

handleFileDelete calls the FileDeleteCommand RPC; on rejection the error is logged as 'Delete failed: <e>' and converted to an ErrorMsg. If the backend reports the directory-not-empty error (recursiveError) and recursive was not set, the UI instead asks the user to confirm a recursive delete.

Source

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

    });
}

export function handleFileDelete(
    model: PreviewModel,
    path: string,
    recursive: boolean,
    setErrorMsg: (msg: ErrorMsg) => void
) {
    fireAndForget(async () => {
        const formattedPath = await model.formatRemoteUri(path, globalStore.get);
        try {
            await model.env.rpc.FileDeleteCommand(TabRpcClient, {
                path: formattedPath,
                recursive,
            });
        } catch (e) {
            const errorText = `${e}`;
            console.warn(`Delete failed: ${errorText}`);
            let errorMsg: ErrorMsg;
            if (errorText.includes(recursiveError) && !recursive) {
                errorMsg = {
                    status: "Confirm Delete Directory",
                    text: "Deleting a directory requires the recursive flag. Proceed?",
                    level: "warning",
                    buttons: [
                        {
                            text: "Delete Recursively",
                            onClick: () => handleFileDelete(model, path, true, setErrorMsg),
                        },
                    ],
                };
            } else {
                errorMsg = {
                    status: "Delete Failed",
                    text: `${e}`,
                };

View on GitHub (pinned to a4447c1563)

Solutions

  1. If prompted 'Deleting a directory requires the recursive flag', confirm to retry with recursive=true
  2. Check the logged error text for the exact backend reason (permissions, not found)
  3. Refresh the preview to clear stale entries, then retry
  4. Verify permissions on the target path or parent directory

Example fix

// before
await model.env.rpc.FileDeleteCommand(TabRpcClient, { path: formattedPath, recursive });
// after
if (isDir && !recursive) {
    // prompt user first
    recursive = await confirmRecursiveDelete(formattedPath);
}
await model.env.rpc.FileDeleteCommand(TabRpcClient, { path: formattedPath, recursive });
Defensive patterns

Strategy: try-catch

Validate before calling

// before deleting a directory, require explicit recursive consent
if (isDirectory(path) && !recursive) {
    recursive = await confirm('Delete directory and all contents?');
}
if (!(await uriExists(formattedPath))) return; // nothing to delete

Type guard

function isRecursiveRequiredError(errorText: string, recursiveError: string): boolean {
    return errorText.includes(recursiveError) && !recursive;
}

Try / catch

try {
    await model.env.rpc.FileDeleteCommand(TabRpcClient, { path: formattedPath, recursive });
} catch (e) {
    const errorText = `${e}`;
    console.warn(`Delete failed: ${errorText}`);
    if (errorText.includes(recursiveError) && !recursive) {
        setErrorMsg({ status: 'Confirm Delete Directory', text: 'Deleting a directory requires the recursive flag. Proceed?', level: 'warning' });
    } else {
        setErrorMsg({ status: 'Delete Failed', text: errorText });
    }
}

Prevention

When it happens

Trigger: FileDeleteCommand rejects: path does not exist, permission denied, or deleting a non-empty directory without recursive=true (handled specially as 'Confirm Delete Directory').

Common situations: Deleting a populated directory without the recursive flag; deleting on a read-only mount or without permissions; a stale preview entry for a file already removed elsewhere.

Related errors


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