Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4577330
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T20:19:52+00:00 2026-05-21T20:19:52+00:00

I try to cast message to a gen_server: gen_server:cast({global, ID}, {watchers}). The handler is:

  • 0

I try to cast message to a gen_server:

 gen_server:cast({global, ID}, {watchers}).

The handler is:

handle_cast({watchers}, State) ->
    case State#table_state.watchers of
    [] ->
        {reply, no_watchers, State};
    _ ->
        {reply, State#table_state.watchers, State}
    end;

But when I execute gen_server:cast the gen_server terminates with error:

=ERROR REPORT==== 29-Apr-2011::18:26:07 ===
** Generic server 1 terminating 
** Last message in was {'$gen_cast',{watchers}}
** When Server state == {table_state,1,"1",11,[]}
** Reason for termination == 
** {bad_return_value,{reply, no_watchers, {table_state,3,"3",11,[]}}}

Why do I get bad_return_value?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T20:19:52+00:00Added an answer on May 21, 2026 at 8:19 pm

    You cannot reply using cast (see gen_server documentation). That is the whole point of casting an asynchronous message instead of using call.

    In your case you want to return a reply, so use gen_server:call/2 instead.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I try to cast an object to my Action class, but it results in
Try to see which cast is faster (not necessary better): new c++ case or
How do I get an NSString from console input, and then try to cast
When I try to use a static_cast to cast a double* to an int*,
When i try to check Session[userId] != null why i get this message Possible
I have downloaded DeepEmailMiner-v1-source.zip from http://sourceforge.net/projects/deepemailminer/files/DeepEmailMiner/Version%20v1/ . But when I try to execute DeepMailMiner.java
I've created my own exception but when I try to use it I receive
I'm using System::Text::RegularExpressions::Regex to try and find a startup message in a log file.
Try loading this normal .jpg file in Internet Explorer 6.0. I get an error
try { ... } catch (SQLException sqle) { String theError = (sqle).getSQLState(); ... }

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.