Skip to content

[Bug]: unexpected message error with watch protocol #2894

Description

@jbedard

What happened?

Custom use of watch protocol occasionally produces an error such as:

[Sign in to Adobe | Slack](https://cclight.slack.com/archives/C01HNHS9C8G/p1780464900153499)
Sign in to Adobe | Slack
Find and sign in to your Slack workspace.
 
<i> [webpack-dev-server] 404s will fallback to '/index-local.html'
<i> [webpack-dev-server] Listening on https://localhost.adobe.com:8080● worker: ui-main-thread ━━━━━━━━━━━━━━━━━━━━━━━━━ (34%) [00:00:00] building javascript/esm|/Users/lazd/dev/.bazel/output_root/11b1052b8c92b8289cf7ea44b2ff22b1/execroo
● worker: authoring-worker ━━━━━━━━━━━━━━━━━━━━━━━━━ (52%) [00:00:00] building javascript/esm|/Users/lazd/dev/.bazel/output_root/11b1052b8c92b8289cf7ea44b2ff22b1/execr
● worker: ui-main-thread ━━━━━━━━━━━━━━━━━━━━━━━━━ (44%) [00:00:02] building javascript/esm|/Users/lazd/dev/.bazel/output_root/11b1052b8c92b8289cf7ea44b2ff22b1/execroo
● worker: authoring-worker ━━━━━━━━━━━━━━━━━━━━━━━━━ (48%) [00:00:02] building javascript/esm|/Users/lazd/dev/.bazel/output_root/11b1052b8c92b8289cf7ea44b2ff22b1/execr
● worker: ui-main-thread ━━━━━━━━━━━━━━━━━━━━━━━━━ (70%) [00:00:40] sealing finish modules
● worker: authoring-worker ━━━━━━━━━━━━━━━━━━━━━━━━━ (100%) [00:00:40] emitting after emit
● worker: renderer-worker ━━━━━━━━━━━━━━━━━━━━━━━━━ (100%) [00:00:14] emitting after emit
● quick-actions-authoring-worker ━━━━━━━━━━━━━━━━━━━━━━━━━ (87%) sealing code generation                                                                               /Users/lazd/dev/.bazel/output_root/11b1052b8c92b8289cf7ea44b2ff22b1/execroot/_main/bazel-out/darwin-fastbuild/bin/apps/project-x/web/rspack_bundle_dev.serve_/rspack_bundle_dev.serve.runfiles/_main/tools/skylib/rspack/dist/dev-server/plugin.cjs:191
              reject(new Error(`Expected message kind ${type}, got ${msg.kind}`));
                     ^
Error: Expected message kind CAPS_RESPONSE, got CYCLE
    at tryConsumeMessage (/Users/lazd/dev/.bazel/output_root/11b1052b8c92b8289cf7ea44b2ff22b1/execroot/_main/bazel-out/darwin-fastbuild/bin/apps/project-x/web/rspack_bundle_dev.serve_/rspack_bundle_dev.serve.runfiles/_main/tools/skylib/rspack/dist/dev-server/plugin.cjs:191:22)
    at Socket.dataReceived (/Users/lazd/dev/.bazel/output_root/11b1052b8c92b8289cf7ea44b2ff22b1/execroot/_main/bazel-out/darwin-fastbuild/bin/apps/project-x/web/rspack_bundle_dev.serve_/rspack_bundle_dev.serve.runfiles/_main/tools/skylib/rspack/dist/dev-server/plugin.cjs:202:26)
    at Socket.emit (node:events:508:28)
    at addChunk (node:internal/streams/readable:559:12)
    at readableAddChunkPushByteMode (node:internal/streams/readable:510:3)
    at Readable.push (node:internal/streams/readable:390:5)
    at Pipe.onStreamRead (node:internal/stream_base_commons:189:23)
Node.js v24.10.0
Error: failed to initialize watch protocol: failed to parse response: EOF

Version

Development (host) and target OS/architectures:

Output of bazel --version:

Version of the Aspect rules, or other relevant rules from your
WORKSPACE or MODULE.bazel file:

Language(s) and/or frameworks involved:

How to reproduce

Any other information?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions