Skip to content

IEP-1772 Show meaningful error message instead of invalid command name "program_esp_bins"#1481

Open
sigmaaa wants to merge 2 commits into
masterfrom
IEP-1772
Open

IEP-1772 Show meaningful error message instead of invalid command name "program_esp_bins"#1481
sigmaaa wants to merge 2 commits into
masterfrom
IEP-1772

Conversation

@sigmaaa

@sigmaaa sigmaaa commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator

Description

Replaced invalid command name "program_esp_bins" with userfriendly clickable message that allows edit the target and select the board:

image

Note: After further thought, I went with failing early via a pop-up instead. It avoids waiting for and parsing every OpenOCD message, and it's more accurate: invalid command name "program_esp_bins" can stem from a corrupted configuration file too, not just an unselected board.

image

Also added the same check for jtag flashing

Fixes # (IEP-1772)

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)

How has this been tested?

Connect the esp chip, select a port, but do not select a board and start debug session

Test Configuration:

  • ESP-IDF Version:
  • OS (Windows,Linux and macOS):

Dependent components impacted by this PR:

  • Component 1
  • Component 2

Checklist

  • PR Self Reviewed
  • Applied Code formatting
  • Added Documentation
  • Added Unit Test
  • Verified on all platforms - Windows,Linux and macOS

Summary by CodeRabbit

  • New Features
    • Debug operations now validate board selection before launching; if unconfigured, users receive a confirmation dialog with direct access to edit their launch target.
    • JTAG flash operations include board selection validation; users are prompted with a confirmation dialog when board configuration is missing, allowing immediate target configuration.

@sigmaaa sigmaaa self-assigned this Jun 18, 2026
@coderabbitai

coderabbitai Bot commented Jun 18, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Adds "no board selected" validation to two launch paths: the OpenOCD debug delegate (LaunchConfigurationDelegate) and the JTAG serial flash delegate (SerialFlashLaunchConfigDelegate). Both paths use a refactored JtagVariableResolver.isBoardConfigResolvable() check plus a "board/" substring fallback. The debug path routes through a new registered IStatusHandler (BoardNotSelectedStatusHandler, code 6001); the flash path uses a direct dialog. Both prompt the user to open the launch target editor.

Changes

Board-not-selected guard across debug and flash launch paths

Layer / File(s) Summary
JtagVariableResolver board-config resolution refactor
bundles/com.espressif.idf.core/.../variable/JtagVariableResolver.java
Extracts board config file resolution into a new private resolveBoardConfigFiles() returning List<String>, updates argument building to iterate that list, and gates isBoardConfigResolvable() on the list being non-empty.
OpenOCD debug launch board validation and status handler
bundles/com.espressif.idf.debug.gdbjtag.openocd/plugin.xml, ...dsf/LaunchConfigurationDelegate.java, ...ui/BoardNotSelectedStatusHandler.java, ...ui/Messages.java, ...ui/messages.properties
Registers a statusHandler extension (code 6001) in plugin.xml; adds BOARD_NOT_SELECTED_STATUS_CODE constant and an early-abort board check in checkBinaryDetails that dispatches to BoardNotSelectedStatusHandler. The handler shows a confirmation dialog and opens the active launch target editor on confirmation.
Serial JTAG flash launch board validation
bundles/com.espressif.idf.launch.serial.core/.../SerialFlashLaunchConfigDelegate.java, .../Messages.java, .../messages.properties
Adds isBoardConfigured() and showBoardNotSelectedMessage() helpers; the JTAG path in launch() returns early when no board is configured, showing the "no board selected" confirmation dialog and opening the launch target editor on confirmation.

Sequence Diagram

sequenceDiagram
  participant User
  participant LaunchConfigurationDelegate
  participant JtagVariableResolver
  participant BoardNotSelectedStatusHandler
  participant ILaunchTargetUIManager

  User->>LaunchConfigurationDelegate: start debug launch
  LaunchConfigurationDelegate->>JtagVariableResolver: isBoardConfigResolvable()
  JtagVariableResolver-->>LaunchConfigurationDelegate: false
  LaunchConfigurationDelegate->>LaunchConfigurationDelegate: fallback - resolve config options, check "board/"
  LaunchConfigurationDelegate->>BoardNotSelectedStatusHandler: handleStatus(code=6001)
  BoardNotSelectedStatusHandler->>User: show "No board selected" confirmation dialog
  User-->>BoardNotSelectedStatusHandler: confirm
  BoardNotSelectedStatusHandler->>ILaunchTargetUIManager: editLaunchTarget(activeLaunchTarget)
  LaunchConfigurationDelegate->>LaunchConfigurationDelegate: throw DebugException(OK_STATUS) — abort launch
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • espressif/idf-eclipse-plugin#1027: Introduces and extends JtagVariableResolver and board/target variable resolution, which this PR directly refactors and builds upon.
  • espressif/idf-eclipse-plugin#1226: Modifies JtagVariableResolver board-key normalization logic that directly affects the isBoardConfigResolvable() outcome used in this PR's validation checks.

Suggested labels

needs translation:CN

Suggested reviewers

  • alirana01
  • kolipakakondal

Poem

🐇 Hop hop, no board in sight?
I'll stop the launch before it takes flight!
A dialog pops — "Please pick a board!"
Click yes and the target editor is restored.
No more mystery errors, just a helpful guide,
The rabbit ensures your config is supplied! 🎯

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 19.35% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title directly matches the PR objective: replacing an invalid 'program_esp_bins' error with a meaningful board selection message.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch IEP-1772

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@sigmaaa

sigmaaa commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator Author

After further thought, I went with failing early via a pop-up instead. It avoids waiting for and parsing every OpenOCD message, and it's more accurate: invalid command name "program_esp_bins" can stem from a corrupted configuration file too, not just an unselected board.

image

Also added the same check for jtag flashing

@sigmaaa sigmaaa added this to the v4.4.0 milestone Jun 18, 2026
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.

1 participant