Skip to content

fix(dispatch): getFailedCounts is not a function - missing optional chaining #89116

@Bigzhangbig

Description

@Bigzhangbig

Bug Description

getDispatcherFinalOutcomeCounts() in dist/dispatch-DphqeP-y.js throws TypeError: dispatcher.getFailedCounts is not a function because it lacks optional chaining (?.).

Root Cause

Line 455 in dispatch-DphqeP-y.js:

function getDispatcherFinalOutcomeCounts(dispatcher) {
    return {
        cancelled: dispatcher.getCancelledCounts?.().final ?? 0,  // ✓ uses ?. 
        failed: dispatcher.getFailedCounts().final                 // ✗ missing ?.
    };
}

Line 454 correctly uses optional chaining for getCancelledCounts, but line 455 does not for getFailedCounts. This is inconsistent.

Expected Behavior

The function should use optional chaining consistently:

failed: dispatcher.getFailedCounts?.().final ?? 0

Environment

  • OpenClaw version: 2026.5.28 (e932160)
  • OS: Ubuntu 24.04 LTS

Impact

This error crashes dispatch operations when the dispatcher object doesn't have the getFailedCounts method (e.g., certain plugin-provided dispatchers or custom configurations).

Suggested Fix

Add optional chaining to line 455 to match line 454's pattern.

Metadata

Metadata

Assignees

No one assigned

    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