Skip to content

[copilot-finds] Bug: getHostAddress() drops original URL parsing error cause #191

@github-actions

Description

@github-actions

Problem

getHostAddress() in DurableTaskAzureManagedClientOptions (packages/durabletask-js-azuremanaged/src/options.ts, line 104) catches URL parsing errors and re-throws a new Error with a descriptive message, but drops the original error. This makes it difficult to diagnose why a specific endpoint URL is invalid (e.g., invalid characters, malformed port, encoding issues).

// Current code (line 104-105)
} catch {
  throw new Error(`Invalid endpoint URL: ${endpoint}`);
}

Root Cause

The catch block does not bind the caught error and does not pass it as the cause property of the new Error. This pattern is inconsistent with the rest of the codebase — for example, pb-helper.util.ts:434 correctly uses { cause: err } when wrapping parsing errors.

Proposed Fix

Change the catch block to preserve the original error as the cause:

} catch (e) {
  throw new Error(`Invalid endpoint URL: ${endpoint}`, { cause: e });
}

Impact

  • Severity: Low-medium. Does not affect runtime behavior, but degrades debuggability when users configure invalid endpoint URLs.
  • Affected scenarios: Any use of DurableTaskAzureManagedClientBuilder or DurableTaskAzureManagedWorkerBuilder with an invalid endpoint URL.
  • Cross-SDK alignment: The { cause } pattern is the established error wrapping convention in this codebase.

Metadata

Metadata

Assignees

No one assigned

    Labels

    copilot-findsFindings from daily automated code review agent

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions