Skip to content

[Bug]: Empty catch blocks swallow errors silently, hindering debugging #63423

@WadydX

Description

@WadydX

Bug type

Code quality / Developer experience

Beta release blocker

No

Summary

Multiple locations in the codebase use empty catch blocks (} catch {}) that silently swallow errors. This makes debugging failures difficult and can mask real issues in production.

Steps to reproduce

  1. Open the following files in the codebase:
    • src/pairing/pairing-store.ts (line 510)
    • src/pairing/setup-code.ts (lines 129, 166)
    • src/infra/home-dir.ts (line 63)
    • src/infra/brew.ts (line 9)
    • src/infra/ports-lsof.ts (lines 13, 32)
  2. Observe the empty catch blocks that swallow errors without logging

Expected behavior

Errors should be logged at minimum (even at debug level) so failures are traceable during troubleshooting. Empty catch blocks should either:

  1. Log the error for debugging: } catch (err) { logger.debug("Operation failed:", err); }
  2. Include an explicit comment explaining why the error is intentionally ignored: } catch { // Intentionally ignored: file may not exist on first run }

Actual behavior

The empty catch blocks silently swallow all errors, making it impossible to diagnose issues without manually adding instrumentation.

OpenClaw version

2026.4.8

Operating system

macOS (Darwin 25.4.0 arm64)

Install method

pnpm from source

Model

N/A

Provider / routing chain

N/A

Additional provider/model setup details

Issue is in TypeScript source code, not runtime model execution.

Logs, screenshots, and evidence

src/pairing/pairing-store.ts:510    } catch {}
src/pairing/setup-code.ts:129     } catch {}
src/pairing/setup-code.ts:166     } catch {}
src/infra/home-dir.ts:63          } catch {}
src/infra/brew.ts:9               } catch {}
src/infra/ports-lsof.ts:13        } catch {}
src/infra/ports-lsof.ts:32        } catch {}

Impact and severity

Affected users/systems/channels: Contributors debugging OpenClaw issues
Severity: Medium (impacts developer experience)
Frequency: Always when errors occur in these code paths

Additional information

Supersedes #63359 (improperly formatted). ESLint rule @typescript-eslint/no-empty-function or similar could prevent this pattern.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions