Skip to content

Improve error message for actorOf on typed ActorSystem#2798

Merged
He-Pin merged 1 commit intoapache:mainfrom
He-Pin:port-typed-guardian-error-msg
Mar 28, 2026
Merged

Improve error message for actorOf on typed ActorSystem#2798
He-Pin merged 1 commit intoapache:mainfrom
He-Pin:port-typed-guardian-error-msg

Conversation

@He-Pin
Copy link
Copy Markdown
Member

@He-Pin He-Pin commented Mar 28, 2026

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

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>
@He-Pin He-Pin marked this pull request as ready for review March 28, 2026 07:04
@He-Pin He-Pin added this to the 2.0.0-M2 milestone Mar 28, 2026
Copy link
Copy Markdown
Member

@pjfanning pjfanning left a comment

Choose a reason for hiding this comment

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

lgtm

@He-Pin He-Pin merged commit c9713f0 into apache:main Mar 28, 2026
9 checks passed
@He-Pin He-Pin deleted the port-typed-guardian-error-msg branch March 28, 2026 09:00
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.

2 participants