aosabook/500lines · error · Exception

Could not communicate with dispatcher server: %s

Error message

Could not communicate with dispatcher server: %s

What it means

Error "Could not communicate with dispatcher server: %s" thrown in aosabook/500lines.

Source

Thrown at ci/code/repo_observer.py:49

    while True:
        try:
            # call the bash script that will update the repo and check
            # for changes. If there's a change, it will drop a .commit_id file
            # with the latest commit in the current working directory
            subprocess.check_output(["./update_repo.sh", args.repo])
        except subprocess.CalledProcessError as e:
            raise Exception("Could not update and check repository. Reason: %s" % e.output)

        if os.path.isfile(".commit_id"):
            # great, we have a change! let's execute the tests
            # First, check the status of the dispatcher server to see
            # if we can send the tests
            try:
                response = helpers.communicate(dispatcher_host,
                                               int(dispatcher_port),
                                               "status")
            except socket.error as e:
                raise Exception("Could not communicate with dispatcher server: %s" % e)
            if response == "OK":
                # Dispatcher is present, let's send it a test
                commit = ""
                with open(".commit_id", "r") as f:
                    commit = f.readline()
                response = helpers.communicate(dispatcher_host,
                                               int(dispatcher_port),
                                               "dispatch:%s" % commit)
                if response != "OK":
                    raise Exception("Could not dispatch the test: %s" %
                    response)
                print "dispatched!"
            else:
                # Something wrong happened to the dispatcher
                raise Exception("Could not dispatch the test: %s" %
                response)
        time.sleep(5)

View on GitHub (pinned to fba689d101)

Solutions

  1. Start the dispatcher server before running repo_observer.
  2. Confirm the --dispatcher-server host:port argument matches where the dispatcher is actually listening.
  3. Check that no firewall or port conflict blocks the socket connection.

Example fix

python dispatcher.py --port 8888 &  # then run: python repo_observer.py --dispatcher-server localhost:8888 /path/to/repo

When it happens

Trigger: Thrown at ci/code/repo_observer.py:49 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of aosabook/500lines@fba689d101 (2026-08-13). Data as JSON: /api/errors/548ef2912d8be092. Report an issue: GitHub.