Skip to content

chore: fix incorrect panic messages for viper flag binding#431

Merged
chlins merged 1 commit intomodelpack:mainfrom
rishi-jat:fix/panic-message-bind-flags
Feb 28, 2026
Merged

chore: fix incorrect panic messages for viper flag binding#431
chlins merged 1 commit intomodelpack:mainfrom
rishi-jat:fix/panic-message-bind-flags

Conversation

@rishi-jat
Copy link
Contributor

Summary

Fix incorrect panic messages in multiple commands where
"bind cache ... flags to viper" was used.

All messages now correctly reference their respective command
(e.g., "bind build flags to viper", "bind prune flags to viper", etc.).

No functional changes.
Improves clarity and consistency in error reporting.

Signed-off-by: Rishi Jat <rishijat098@gmail.com>
Copilot AI review requested due to automatic review settings February 27, 2026 12:22
@gemini-code-assist
Copy link

Summary of Changes

Hello, 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 refines the error reporting mechanism by correcting misleading panic messages across several command-line tools. The update ensures that when an error occurs during the binding of command flags to the Viper configuration library, the resulting panic message precisely identifies the command involved, thereby enhancing diagnostic clarity without altering any core functionality.

Highlights

  • Improved Error Messages: Corrected panic messages in various commands to accurately reflect the command binding flags to Viper, replacing generic "bind cache ... flags to viper" messages with command-specific ones (e.g., "bind build flags to viper").
  • Enhanced Clarity: The changes improve the clarity and consistency of error reporting across the application, making diagnostics more straightforward.
  • No Functional Impact: These modifications are purely cosmetic and do not introduce any functional changes to the application's behavior.
Changelog
  • cmd/attach.go
    • Updated the panic message for Viper flag binding from "bind cache list flags to viper" to "bind attach flags to viper".
  • cmd/build.go
    • Updated the panic message for Viper flag binding from "bind cache list flags to viper" to "bind build flags to viper".
  • cmd/extract.go
    • Updated the panic message for Viper flag binding from "bind cache extract flags to viper" to "bind extract flags to viper".
  • cmd/fetch.go
    • Updated the panic message for Viper flag binding from "bind cache pull flags to viper" to "bind fetch flags to viper".
  • cmd/inspect.go
    • Updated the panic message for Viper flag binding from "bind cache inspect flags to viper" to "bind inspect flags to viper".
  • cmd/list.go
    • Updated the panic message for Viper flag binding from "bind cache list flags to viper" to "bind list flags to viper".
  • cmd/login.go
    • Updated the panic message for Viper flag binding from "bind cache login flags to viper" to "bind login flags to viper".
  • cmd/logout.go
    • Updated the panic message for Viper flag binding from "bind cache logout flags to viper" to "bind logout flags to viper".
  • cmd/modelfile/generate.go
    • Updated the panic message for Viper flag binding from "bind cache list flags to viper" to "bind generate flags to viper".
  • cmd/prune.go
    • Updated the panic message for Viper flag binding from "bind cache rm flags to viper" to "bind prune flags to viper".
  • cmd/pull.go
    • Updated the panic message for Viper flag binding from "bind cache pull flags to viper" to "bind pull flags to viper".
  • cmd/push.go
    • Updated the panic message for Viper flag binding from "bind cache push flags to viper" to "bind push flags to viper".
  • cmd/rm.go
    • Updated the panic message for Viper flag binding from "bind cache rm flags to viper" to "bind rm flags to viper".
  • cmd/tag.go
    • Updated the panic message for Viper flag binding from "bind cache tag flags to viper" to "bind tag flags to viper".
  • cmd/upload.go
    • Updated the panic message for Viper flag binding from "bind cache list flags to viper" to "bind upload flags to viper".
Activity
  • No human activity has occurred on this pull request yet.
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.

Copy link

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

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 correctly fixes several incorrect panic messages related to Viper flag binding across multiple commands, improving clarity and consistency in error reporting. While reviewing these changes, I identified a critical bug in cmd/prune.go where flags from the rm command are being used incorrectly. Please see my specific comment for details on this issue.

Copy link

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 corrects copy/pasted panic message text used when binding Cobra flags to Viper across multiple CLI commands, improving the clarity/accuracy of error context without changing behavior.

Changes:

  • Updated viper.BindPFlags panic messages to reference the correct command name.
  • Removed incorrect “bind cache … flags to viper” wording across affected commands.

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated no comments.

Show a summary per file
File Description
cmd/upload.go Fix bind-to-viper panic message to reference upload.
cmd/tag.go Fix bind-to-viper panic message to reference tag.
cmd/rm.go Fix bind-to-viper panic message to reference rm.
cmd/push.go Fix bind-to-viper panic message to reference push.
cmd/pull.go Fix bind-to-viper panic message to reference pull.
cmd/prune.go Fix bind-to-viper panic message to reference prune.
cmd/modelfile/generate.go Fix bind-to-viper panic message to reference generate.
cmd/logout.go Fix bind-to-viper panic message to reference logout.
cmd/login.go Fix bind-to-viper panic message to reference login.
cmd/list.go Fix bind-to-viper panic message to reference list.
cmd/inspect.go Fix bind-to-viper panic message to reference inspect.
cmd/fetch.go Fix bind-to-viper panic message to reference fetch.
cmd/extract.go Fix bind-to-viper panic message to reference extract.
cmd/build.go Fix bind-to-viper panic message to reference build.
cmd/attach.go Fix bind-to-viper panic message to reference attach.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@rishi-jat
Copy link
Contributor Author

/cc @chlins

Copy link
Member

@chlins chlins left a comment

Choose a reason for hiding this comment

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

lgtm

@chlins chlins merged commit fa8cebb into modelpack:main Feb 28, 2026
10 of 12 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.

3 participants