Skip to content

Critical: File operations fail silently without user notification #1152

@coderabbitai

Description

@coderabbitai

Problem

Many critical file operations in superfile fail silently when errors occur. Errors are logged via slog.Error but never surfaced to the user through UI notifications or modals. This creates a poor user experience where operations appear to succeed but actually fail, leaving users confused about the application state.

Why Silent Failures Are Bad

  1. Poor User Experience: Users don't know their operation failed or why
  2. Data Loss Risk: Users may assume files were copied/deleted/renamed when they weren't
  3. Debugging Difficulty: Users can't report meaningful bugs without error messages
  4. Trust Issues: Silent failures erode confidence in the application
  5. No Recovery Path: Users can't take corrective action if they don't know what failed

Examples of Silent Failures

1. Bulk Rename Editor Errors (src/internal/model.go)

  • Line 570: No pending editor action found - logs and returns nil
  • Line 581: Editor finished with error - logs and returns nil
  • Line 591-593: Line count mismatch between tmpfile and selected files - logs and returns nil
  • Line 612: Failed to read tmpfile - logs and returns error without user notification

2. Delete Operation Failures (src/internal/handle_file_operations.go)

  • Line 141: Cannot spawn a new process - returns Failed state without user notification
  • Line 153: Error in delete operation - breaks loop but no immediate user feedback
  • Line 167: Failed to send final delete operation update - logs only

3. Copy/Paste Operation Failures (src/internal/handle_file_operations.go)

  • Line 281: Cannot spawn a new process for copy - returns Failed without notification
  • Line 306: Copy errors - sets Failed state but no immediate user notification
  • Line 319: Could not send final update for process Bar - logs only

4. Extract/Compress Failures (src/internal/handle_file_operations.go)

  • Line 362: Error unexpected file - unsupported extension, returns nil silently
  • Lines 374-387: Multiple extract errors (rename, mkdir, extract) - return Failed without notification
  • Lines 415-421: Compress errors (getZipArchiveName, zipSources) - return Failed without notification

5. Panel Creation Failures (src/internal/key_function.go)

  • Line 69: error while creating new panel - logs only, continues silently

6. Directory Reading Failures (src/internal/function.go)

  • Lines 70-71: Error while returning folder elements - returns nil, empty panel
  • Lines 92-93: Error while return folder element function - returns nil, empty panel

7. Initialization Failures (src/internal/config_function.go)

  • Line 66: exiftool init error - logs only, continues with nil
  • Line 79: zoxide client init error - logs only, feature silently unavailable
  • Lines 102, 108: file panel dir errors - logs only, falls back to home without notifying user

Proposed Solution

For critical user-initiated file operations (delete, copy, rename, compress, extract), we should:

  1. Surface errors via notify.New() with:

    • Clear error title (e.g., "Delete Failed", "Bulk Rename Error")
    • Descriptive message explaining what went wrong
    • Appropriate action type (usually notify.NoAction for errors)
  2. Keep process bar integration for async operations that already show progress

  3. Example fix for bulk rename line count mismatch:

if len(lines) != len(action.SelectedFiles) {
    slog.Error("Number of lines in tmpfile doesn't match number of selected files",
        "expected", len(action.SelectedFiles), "got", len(lines))
    m.notifyModel = notify.New(true, "Bulk Rename Error",
        "Line count mismatch between edited names and selected files.",
        notify.NoAction)
    return nil
}

Scope

This issue tracks:

  • ✅ Identifying all silent failure points in file operations
  • ⬜ Adding user notifications for critical failures
  • ⬜ Maintaining slog logging for debugging
  • ⬜ Testing error paths to ensure notifications appear correctly

Related

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingenhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions