⚠ This page is served via a proxy. Original site: https://github.com
This service does not collect credentials or authentication data.
Skip to content

Conversation

@redpanda-f
Copy link
Collaborator

No description provided.

@redpanda-f redpanda-f added this to the M4.0: mainnet staged milestone Feb 2, 2026
Copilot AI review requested due to automatic review settings February 2, 2026 08:18
@FilOzzy FilOzzy added this to FOC Feb 2, 2026
@github-project-automation github-project-automation bot moved this to 📌 Triage in FOC Feb 2, 2026
@redpanda-f redpanda-f linked an issue Feb 2, 2026 that may be closed by this pull request
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves the user experience when Docker CLI is not installed by adding a friendly error message instead of the default "No such file or directory" error. The change is localized to the init command's cleanup function.

Changes:

  • Adds docker_not_found_error() helper function that returns a user-friendly error message
  • Wraps two Docker command invocations (docker images and docker rmi) with error handling that detects ErrorKind::NotFound and returns the friendly message

Comment on lines 24 to 26
"Docker CLI not found. Install Docker Desktop and ensure the 'docker' command is on PATH, then re-run 'foc-devnet init'."
.to_string()
.into()
Copy link

Copilot AI Feb 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error message string should be defined as a constant rather than being hardcoded. According to the project's coding guidelines, magic strings should be extracted to constants, typically in src/constants.rs. This improves maintainability and allows the message to be reused if needed elsewhere in the codebase.

Consider defining a constant like:

pub const DOCKER_NOT_FOUND_ERROR: &str = "Docker CLI not found. Install Docker Desktop and ensure the 'docker' command is on PATH, then re-run 'foc-devnet init'.";

Copilot generated this review using guidance from repository custom instructions.
Comment on lines +61 to +65
.output()
.map_err(|err| match err.kind() {
ErrorKind::NotFound => docker_not_found_error(),
_ => err.into(),
})?;
Copy link

Copilot AI Feb 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This error handling for Docker CLI not found is only applied in the init command's cleanup function, but there are 20+ other locations throughout the codebase that use Command::new("docker") without this error handling. This creates an inconsistent user experience where users might get a helpful error message here but a generic "No such file or directory" error elsewhere.

Consider centralizing this error handling in the docker_command function in src/docker/core.rs (line 51-53), which already serves as the centralized wrapper for Docker commands. This would provide consistent error messages across the entire codebase without requiring changes to every call site.

For example, the run_command function in src/docker/core.rs could be enhanced to detect ErrorKind::NotFound and provide context about which program was not found.

Copilot uses AI. Check for mistakes.

/// Create a friendly error for missing Docker CLI.
fn docker_not_found_error() -> Box<dyn std::error::Error> {
"Docker CLI not found. Install Docker Desktop and ensure the 'docker' command is on PATH, then re-run 'foc-devnet init'."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe just "Install Docker" since we don't actually need Desktop?

@rjan90 rjan90 moved this from 📌 Triage to 🔎 Awaiting review in FOC Feb 2, 2026
Copy link
Contributor

@rvagg rvagg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TIL about std::io::ErrorKind::NotFound

@github-project-automation github-project-automation bot moved this from 🔎 Awaiting review to ✔️ Approved by reviewer in FOC Feb 2, 2026
@redpanda-f redpanda-f merged commit 020a1d5 into main Feb 2, 2026
2 checks passed
@github-project-automation github-project-automation bot moved this from ✔️ Approved by reviewer to 🎉 Done in FOC Feb 2, 2026
@redpanda-f redpanda-f deleted the feat/redpanda/docker-not-installed-error-fix branch February 2, 2026 10:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 🎉 Done

Development

Successfully merging this pull request may close these issues.

cargo run -- init fails with NotFound when docker is not installed.

3 participants