Improve error message for actorOf on typed ActorSystem#2798
Merged
He-Pin merged 1 commit intoapache:mainfrom Mar 28, 2026
Merged
Improve error message for actorOf on typed ActorSystem#2798He-Pin merged 1 commit intoapache:mainfrom
He-Pin merged 1 commit intoapache:mainfrom
Conversation
When calling system.actorOf() on a typed ActorSystem, provide a more helpful error message explaining that top-level actors should be spawned as children of the guardian behavior, or a classic ActorSystem should be used instead. The generic 'custom user guardian' message is preserved for non-typed custom guardians. Fix upstream bug: the isTypedGuardian check used startsWith with a package prefix that never matched due to case mismatch (T vs t). Use exact class name match instead. Upstream: akka/akka-core@f73fae3783 Cherry-picked from akka/akka-core v2.8.0, which is now Apache licensed. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
When users accidentally call classic actorOf on a typed ActorSystem, the error message was confusing and did not clearly explain the problem.
Modification
Improved the error message to clearly state that classic actor creation is not supported on typed ActorSystem, and suggest using typed actor spawning instead. Fixed isTypedGuardian detection.
Result
Users get actionable guidance when they hit this common migration pitfall.
References