Skip to content

Add descriptive error when orchestration type is not registered#261

Merged
torosent merged 3 commits intomainfrom
fix/descriptive-error-for-unknown-orchestration-type
Feb 9, 2026
Merged

Add descriptive error when orchestration type is not registered#261
torosent merged 3 commits intomainfrom
fix/descriptive-error-for-unknown-orchestration-type

Conversation

@torosent
Copy link
Member

@torosent torosent commented Feb 8, 2026

Issue describing the changes in this PR

Replaces a cryptic NullPointerException (Cannot invoke "TaskOrchestrationFactory.create()" because "factory" is null) with a descriptive IllegalStateException when a worker receives an orchestration event for a type it does not have registered.

The new error message clearly states the orchestration type name and explains that this usually means workers that do not support this orchestration type are connected to the task hub.

This addresses the existing TODO at line 885 of TaskOrchestrationExecutor.java.

Pull request checklist

  • My changes do not require documentation changes
  • My changes are added to the CHANGELOG.md
  • I have added all required tests (Unit tests, E2E tests)

Additional information

Before (cryptic):

java.lang.NullPointerException: Cannot invoke "com.microsoft.durabletask.TaskOrchestrationFactory.create()" because "factory" is null

After (descriptive):

java.lang.IllegalStateException: No orchestration factory registered for orchestration type 'MyOrchestration'. This usually means that a worker that does not support this orchestration type is connected to this task hub. Make sure the worker has a registered orchestration for 'MyOrchestration'.

Replace NullPointerException with IllegalStateException containing a
descriptive message when a worker receives an orchestration event for a
type it doesn't have registered. This helps users understand that
workers that don't support the requested orchestration type are
connected to the task hub.
@torosent torosent requested a review from a team as a code owner February 8, 2026 06:41
Copilot AI review requested due to automatic review settings February 8, 2026 06:41
Verifies that executing an orchestration with an unregistered type
produces a FAILED result with an IllegalStateException containing the
orchestration name and guidance about mismatched workers.
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Improves worker-side diagnostics by replacing a cryptic NullPointerException with an explicit, descriptive exception when an orchestration event references an orchestration type that isn’t registered on the worker.

Changes:

  • Add an explicit IllegalStateException when no TaskOrchestrationFactory exists for the incoming orchestration name (including fallback to "*").
  • Provide a more actionable error message that includes the orchestration type name and likely cause/remediation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@torosent torosent merged commit 3fe2f37 into main Feb 9, 2026
8 checks passed
@torosent torosent deleted the fix/descriptive-error-for-unknown-orchestration-type branch February 9, 2026 18:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants