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
- Read the ErrorMsg text/status shown in the preview for the backend reason (e.g. permission denied, already exists)
- Verify the destination name is valid and does not already exist
- Confirm the source file still exists and refresh the preview
- 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
- Check the destination name for collisions before calling FileMoveCommand
- Refresh preview state so srcuri is not stale (source already moved/deleted)
- Confirm write permission on the parent directory of the destination
- Surface the stringified backend error to the user instead of swallowing it
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
- Delete failed: ${errorText}
- Copy failed:
- creating file: %w
- getting file info: %w
- initializing file with empty write: %w
AI-assisted analysis of wavetermdev/waveterm@a4447c1563 (2026-09-01).
Data as JSON: /api/errors/cb2ea5d858b7bd38.
Report an issue: GitHub.