Skip to content

feat(vllm): handle binary not found - #325

Merged
doringeman merged 1 commit into
docker:mainfrom
doringeman:vllm-status-not-found
Oct 27, 2025
Merged

feat(vllm): handle binary not found#325
doringeman merged 1 commit into
docker:mainfrom
doringeman:vllm-status-not-found

Conversation

@doringeman

Copy link
Copy Markdown
Contributor

Record a vLLM binary not found status and show a hint on docker model run.

This can happen when somebody attempts to use a model for vLLM with DMR with the llama.cpp backend installed only with Docker CE.

The next improvement is to add a --backend vllm flag to docker model install-runner.

$ docker model run aistaging/smollm2-vllm hi
error response: status=412 body=vLLM binary not found


What's next:
    It looks like you're trying to use a model for vLLM → docker model install-runner --vllm

Signed-off-by: Dorin Geman <dorin.geman@docker.com>
@doringeman
doringeman requested a review from ilopezluna October 27, 2025 14:09
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @doringeman, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the user experience when interacting with vLLM models by introducing explicit detection and handling for cases where the vLLM binary is missing. It refactors the CLI's error handling to provide more specific feedback and actionable steps to users, including a new hint for installing the vLLM runner, and ensures the backend returns an appropriate HTTP status code for this specific error condition.

Highlights

  • Improved vLLM Error Handling: The system now explicitly detects and reports when the vLLM binary is not found, returning a 412 Precondition Failed HTTP status from the backend and a specific error message in the CLI.
  • Enhanced User Guidance: CLI commands now provide a specific, actionable hint (docker model install-runner --vllm) when a user attempts to run a vLLM model without the necessary binary installed, guiding them on how to resolve the issue.
  • Error Handling Consolidation: The CLI's error handling logic has been refactored by integrating the responsibilities of handleNotRunningError into handleClientError, simplifying the error flow and utilizing errors.Join for better error wrapping.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hey there - I've reviewed your changes - here's some feedback:

  • In handleClientError, use errors.Is(err, vllm.StatusNotFound) instead of substring matching on err.Error() so wrapped errors are detected reliably.
  • Rather than errors.Join(err, errors.New(message)), consider wrapping with fmt.Errorf("%s: %w", message, err) to produce a single chainable error and preserve unwrapping semantics.
  • The v.status assignment in vLLM.Install isn’t used elsewhere—either remove it or document its purpose to avoid confusion.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In handleClientError, use errors.Is(err, vllm.StatusNotFound) instead of substring matching on err.Error() so wrapped errors are detected reliably.
- Rather than errors.Join(err, errors.New(message)), consider wrapping with fmt.Errorf("%s: %w", message, err) to produce a single chainable error and preserve unwrapping semantics.
- The v.status assignment in vLLM.Install isn’t used elsewhere—either remove it or document its purpose to avoid confusion.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request addresses the scenario where the vLLM binary is not found, providing a more informative error message and guidance to the user. The changes involve modifying the error handling logic in several command files and adding a specific check for the vLLM binary not found status. The handleClientError function in cmd/cli/commands/utils.go is updated to include a check for the vllm.StatusNotFound error, and corresponding next steps are printed to the console. Additionally, the vllm.go file now sets the v.status to StatusNotFound.Error() when the binary is not found.

Comment thread cmd/cli/commands/df.go
Comment on lines +20 to 21
return handleClientError(err, "Failed to list running models")
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The handleNotRunningError function is being removed here. This function centralizes the handling of the notRunningErr error, which includes printing next steps to enable the Docker Model Runner. Removing it means that users will no longer see these helpful instructions when the service is not running, making it harder for them to resolve the issue. This could lead to a degraded user experience, as users might not know how to start the Docker Model Runner.

Consider keeping the handleNotRunningError function to ensure users receive guidance on how to resolve the Docker Model Runner is not running error.

Comment on lines +56 to 57
return "", handleClientError(err, "Failed to get model "+modelName)
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The handleNotRunningError function is being removed here. This function centralizes the handling of the notRunningErr error, which includes printing next steps to enable the Docker Model Runner. Removing it means that users will no longer see these helpful instructions when the service is not running, making it harder for them to resolve the issue. This could lead to a degraded user experience, as users might not know how to start the Docker Model Runner.

Consider keeping the handleNotRunningError function to ensure users receive guidance on how to resolve the Docker Model Runner is not running error.

Comment thread cmd/cli/commands/list.go
Comment on lines +63 to 64
return "", handleClientError(err, "Failed to list models")
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The handleNotRunningError function is being removed here. This function centralizes the handling of the notRunningErr error, which includes printing next steps to enable the Docker Model Runner. Removing it means that users will no longer see these helpful instructions when the service is not running, making it harder for them to resolve the issue. This could lead to a degraded user experience, as users might not know how to start the Docker Model Runner.

Consider keeping the handleNotRunningError function to ensure users receive guidance on how to resolve the Docker Model Runner is not running error.

Comment thread cmd/cli/commands/ps.go
Comment on lines +22 to 23
return handleClientError(err, "Failed to list running models")
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The handleNotRunningError function is being removed here. This function centralizes the handling of the notRunningErr error, which includes printing next steps to enable the Docker Model Runner. Removing it means that users will no longer see these helpful instructions when the service is not running, making it harder for them to resolve the issue. This could lead to a degraded user experience, as users might not know how to start the Docker Model Runner.

Consider keeping the handleNotRunningError function to ensure users receive guidance on how to resolve the Docker Model Runner is not running error.

Comment thread cmd/cli/commands/pull.go
Comment on lines +61 to 62
return handleClientError(err, "Failed to pull model")
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The handleNotRunningError function is being removed here. This function centralizes the handling of the notRunningErr error, which includes printing next steps to enable the Docker Model Runner. Removing it means that users will no longer see these helpful instructions when the service is not running, making it harder for them to resolve the issue. This could lead to a degraded user experience, as users might not know how to start the Docker Model Runner.

Consider keeping the handleNotRunningError function to ensure users receive guidance on how to resolve the Docker Model Runner is not running error.

Comment thread cmd/cli/commands/rm.go
Comment on lines +41 to 42
return handleClientError(err, "Failed to remove model")
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The handleNotRunningError function is being removed here. This function centralizes the handling of the notRunningErr error, which includes printing next steps to enable the Docker Model Runner. Removing it means that users will no longer see these helpful instructions when the service is not running, making it harder for them to resolve the issue. This could lead to a degraded user experience, as users might not know how to start the Docker Model Runner.

Consider keeping the handleNotRunningError function to ensure users receive guidance on how to resolve the Docker Model Runner is not running error.

Comment thread cmd/cli/commands/run.go
Comment on lines +686 to 687
return handleClientError(err, "Failed to inspect model")
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The handleNotRunningError function is being removed here. This function centralizes the handling of the notRunningErr error, which includes printing next steps to enable the Docker Model Runner. Removing it means that users will no longer see these helpful instructions when the service is not running, making it harder for them to resolve the issue. This could lead to a degraded user experience, as users might not know how to start the Docker Model Runner.

Consider keeping the handleNotRunningError function to ensure users receive guidance on how to resolve the Docker Model Runner is not running error.

Comment on lines +28 to 29
return handleClientError(err, "Failed to unload models")
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The handleNotRunningError function is being removed here. This function centralizes the handling of the notRunningErr error, which includes printing next steps to enable the Docker Model Runner. Removing it means that users will no longer see these helpful instructions when the service is not running, making it harder for them to resolve the issue. This could lead to a degraded user experience, as users might not know how to start the Docker Model Runner.

Consider keeping the handleNotRunningError function to ensure users receive guidance on how to resolve the Docker Model Runner is not running error.

Comment thread cmd/cli/commands/utils.go
return fmt.Errorf("%w\n%s", err, strings.TrimRight(buf.String(), "\n"))
}
return err
return errors.Join(err, errors.New(message))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The order of arguments in errors.Join is important. The error being checked should come first, followed by the message. This ensures that the original error is checked before adding the new message.

Suggested change
return errors.Join(err, errors.New(message))
return errors.Join(err, errors.New(message))

Comment on lines +250 to +251
} else if errors.Is(err, vllm.StatusNotFound) {
http.Error(w, err.Error(), http.StatusPreconditionFailed)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Returning the error message directly to the client might expose internal implementation details or sensitive information. It's generally better to return a generic error message and log the specific error on the server side.

Suggested change
} else if errors.Is(err, vllm.StatusNotFound) {
http.Error(w, err.Error(), http.StatusPreconditionFailed)
} else if errors.Is(err, vllm.StatusNotFound) {
http.Error(w, "vLLM binary not found", http.StatusPreconditionFailed)

@doringeman
doringeman merged commit 1c872eb into docker:main Oct 27, 2025
6 checks passed
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.

2 participants