arduino-cli icon indicating copy to clipboard operation
arduino-cli copied to clipboard

Compilation error: grpc: error while marshaling: proto: Marshal called with nil

Open KurtE opened this issue 2 years ago • 6 comments

Describe the problem

Sorry there is probably something screwy in this code, that I am hacking up...

I tried to do a verify operation, and the build aborted with an error:

grpc: error while marshaling: proto: Marshal called with nil

Compilation error: grpc: error while marshaling: proto: Marshal called with nil

That was all of the output, all in orangish color.

I have no idea what that error is supposed to imply.

To reproduce

Not sure, but I included the code... Note: this code is not done yet, nor may never be used, but just an experiment on Teensy 3.2, to see if I can use FTM timer to capture pulse widths and maybe generate specific pulses...

I simply clicked on verify with this sketch, which includes a header file, which is part of the sketch.

t3x_test_ftm_pin_capture-220717a.zip

Expected behavior

I am guessing probably lots of error messages.

Arduino IDE version

20220716

Operating system

Windows

Operating system version

Windows 10

Additional context

I am running with yesterdays IDE did not see any updates for today.

Issue checklist

  • [X] I searched for previous reports in the issue tracker
  • [X] I verified the problem still occurs when using the latest nightly build
  • [X] My report contains all necessary details

KurtE avatar Jul 17 '22 16:07 KurtE

I believe I figured it out what happened.

Before this I had done a SaveAs operation to this new name. The code hung with spinning ... So I closed out the window (and process). Restarted IDE. Browsed to the new saved file and tried to do the compile...

But turned out it had forgotten I was building for T3.1/2 and had the simple chose board... in drop down list. Going back up and choose T3.1 now it behaves normal...

Side note: Thought maybe had issue with the new sketch name. So I exited the IDE, used browser to rename the directory and sketch to different name. I then restarted the IDE. Looks like it had issue with not finding the last sketch that was last edited, and gave me a blank window... Also the Sketchbook tab area showed as empty, but was able to go up to File ->Sketchbook and open up the sketch with the new name.

KurtE avatar Jul 17 '22 17:07 KurtE

had the simple chose board... in drop down list.

Do you mean the "❌ No board selected" like this?

image

I gave it a try but I only got the expected "Missing FQBN" message rather than the unexpected error you reported.

I exited the IDE, used browser to rename the directory and sketch to different name. I then restarted the IDE. Looks like it had issue with not finding the last sketch that was last edited, and gave me a blank window...

I guess it is the same issue you reported at https://github.com/arduino/arduino-ide/issues/1089. That will be fixed by https://github.com/arduino/arduino-ide/pull/1152

per1234 avatar Jul 17 '22 22:07 per1234

Maybe, I just reproduced it.

I was verifying fine... Then I decided to program a board, so I turned it on, and tried to compile and it warned that I need to select a board...

I then clicked on the drop down list (select board), which brought up dialog where you can choose the board type..., I then canceled, the dialog.

I then tried to do a verify and got that error. image

KurtE avatar Jul 18 '22 01:07 KurtE

OK, I am able to reproduce it now. I was using a slightly outdated version of the IDE before.

This was a regression introduced by https://github.com/arduino/arduino-ide/commit/73835eced3bda7657308bf582bd5e5690d73879a.

The menu item text was also just changed, but by a different commit unrelated to this new unpleasant error message.

per1234 avatar Jul 18 '22 08:07 per1234

I then clicked on the drop down list (select board), which brought up dialog where you can choose the board type..., I then canceled, the dialog.

It's tracked here: https://github.com/arduino/arduino-ide/issues/1204

kittaakos avatar Jul 18 '22 08:07 kittaakos

I determined this is a bug in the Arduino CLI codebase, so I have moved the issue to the appropriate repository.

I bisected the issue to a5466d017f7767226b090ed9d3e0b8a74617e0da

In case it will be useful, I will provide instructions for reproducing the issue using the Arduino CLI gRPC interface directly (the issue does not occur when using the Arduino CLI command line interface).

Set up

$ arduino-cli version
arduino-cli.exe  Version: 0.25.1-rc1 Commit: 436f0bb9 Date: 2022-07-22T15:47:42Z

$ arduino-cli sketch new /tmp/FooSketch

$ arduino-cli daemon

Demo

Use grpcurl to run the following commands in another terminal:

$ grpcurl \
  -plaintext \
  -import-path ./rpc \
  -proto cc/arduino/cli/commands/v1/commands.proto \
  127.0.0.1:50051 \
  cc.arduino.cli.commands.v1.ArduinoCoreService.Create

{
  "instance": {
    "id": 1
  }
}

$ grpcurl \
  -plaintext \
  -import-path ./rpc \
  -proto cc/arduino/cli/commands/v1/commands.proto \
  -d '{"instance": {"id": 1}}' \
  127.0.0.1:50051 \
  cc.arduino.cli.commands.v1.ArduinoCoreService.Init

$ grpcurl \
  -plaintext \
  -import-path ./rpc \
  -proto cc/arduino/cli/commands/v1/commands.proto \
  -d '{"instance": {"id": 1}, "sketch_path": "/tmp/FooSketch"}' \
  127.0.0.1:50051 \
  cc.arduino.cli.commands.v1.ArduinoCoreService.Compile

ERROR:
  Code: Internal
  Message: grpc: error while marshaling: proto: Marshal called with nil

Since the fqbn field was omitted from the cc.arduino.cli.commands.v1.ArduinoCoreService.Compile request, an error is expected. However, it should be the slightly more user friendly "Missing FQBN (Fully Qualified Board Name)" error that was returned prior to a5466d017f7767226b090ed9d3e0b8a74617e0da.

per1234 avatar Jul 22 '22 15:07 per1234