tonhowtf/omniget · warning

rename failed

Error message

rename failed

What it means

notebooksStore.rename() persists a notebook rename via notesNotebooksRename (Tauri command 'study:notes:notebooks:rename') and then refresh(). If the command rejects, the catch logs 'rename failed' and the UI keeps the old name after refresh, with no error surfaced to the user.

Solutions

  1. Read the logged rejection reason from notesNotebooksRename.
  2. Validate newName (non-empty, length limit) client-side before calling rename().
  3. Verify the notebook still exists (pageCountOf/list) before renaming.
  4. Check the 'study:notes:notebooks:rename' command and capability registration.
  5. Surface a user-visible toast on failure since refresh() will silently restore the old name.

Example fix

// before
async rename(notebookId: number, newName: string) {
  try {
    await notesNotebooksRename({ notebookId, newName });
    await this.refresh();
  } catch (e) {
    console.warn("rename failed", e);
  }
}
// after
async rename(notebookId: number, newName: string) {
  const name = newName.trim();
  if (!name) throw new Error("Notebook name cannot be empty");
  try {
    await notesNotebooksRename({ notebookId, newName: name });
    await this.refresh();
  } catch (e) {
    console.warn("rename failed", e);
    throw e; // let the UI show the failure
  }
}
Defensive patterns

Strategy: validation

Validate before calling

function validateRename(id: number, newName: string): string | null {
  const n = newName.trim();
  if (!n) return 'Name cannot be empty';
  if (n.length > 100) return 'Name too long';
  if (!notebooksStore.list.some((nb) => nb.id === id)) return 'Notebook not found';
  return null;
}

Type guard

function notebookExistsIn(store: NotebooksStore, id: number): boolean {
  return store.list.some((n) => n.id === id);
}

Try / catch

try {
  await notebooksStore.rename(id, newName.trim());
} catch (e) {
  console.warn('rename rejected:', e);
  showToast('Rename failed — the notebook kept its previous name');
  await notebooksStore.refresh();
}

Prevention

When it happens

Trigger: notesNotebooksRename({notebookId, newName}) rejects: notebookId does not exist, backend rejects the new name (empty/too long/duplicate), DB write failure, plugin/capability misconfiguration, or generic IPC failure.

Common situations: Renaming a notebook deleted in another window/session; empty name submitted; name exceeding backend length limit; DB locked; command renamed on backend so the bridge call 404s at invoke level.

Understand the failure class

Background: "API request failed": what wrapped HTTP errors from external APIs mean and how to find the real cause — this error's family across 29 libraries.

Related errors


AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12). Data as JSON: /api/errors/539e5f4f917e5af7. Report an issue: GitHub.

Appendix: source

Thrown at src/lib/study-notes/notebooks-store.svelte.ts:120

    color?: string | null;
    iconLucide?: string | null;
  }): Promise<number | null> {
    try {
      const r = await notesNotebooksCreate(args);
      await this.refresh();
      return r.notebook_id;
    } catch (e) {
      console.warn("create notebook failed", e);
      return null;
    }
  }

  async rename(notebookId: number, newName: string) {
    try {
      await notesNotebooksRename({ notebookId, newName });
      await this.refresh();
    } catch (e) {
      console.warn("rename failed", e);
    }
  }

  async close(notebookId: number) {
    try {
      await notesNotebooksClose(notebookId);
      if (this.activeId === notebookId) {
        await this.setActive(1);
      }
      await this.refresh();
    } catch (e) {
      console.warn("close failed", e);
    }
  }

  async reopen(notebookId: number) {
    try {
      await notesNotebooksReopen(notebookId);

View on GitHub (pinned to 8600b91f42)