Skip to content

Fix mill visualize with no arguments failing with MatchError#6973

Draft
Copilot wants to merge 3 commits intomainfrom
copilot/fix-visualize-error-message
Draft

Fix mill visualize with no arguments failing with MatchError#6973
Copilot wants to merge 3 commits intomainfrom
copilot/fix-visualize-error-message

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 30, 2026

Running mill visualize with no arguments crashes with an unhelpful MatchError: List() deep in the resolution stack. This adds an early guard to return a clear failure message instead.

Changes

  • VisualizeModule.visualize0 (both the current overload and the deprecated bin-compat one): added upfront empty-tasks check that short-circuits with a descriptive Result.Failure before any task resolution occurs

Before:

scala.MatchError: List() (of class scala.collection.immutable.Nil$)
  mill.resolve.Resolve.handleScriptModule$1(Resolve.scala:395)
  ...

After:

error] visualize requires at least one task to visualize, e.g. `mill visualize __.compile`

Copilot AI changed the title [WIP] Improve error message for visualize command without arguments Fix mill visualize with no arguments failing with MatchError Mar 30, 2026
Copilot AI requested a review from alexarchambault March 30, 2026 17:48
Copy link
Copy Markdown
Collaborator

@alexarchambault alexarchambault left a comment

Choose a reason for hiding this comment

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

Don't use return statements

Agent-Logs-Url: https://github.com/com-lihaoyi/mill/sessions/2d1d2f9b-9db9-404f-8185-4e5f134d1c65

Co-authored-by: alexarchambault <7063723+alexarchambault@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 3, 2026

Don't use return statements

Done in 7b36cb7 — replaced both return statements with if/else expressions.

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.

Running visualize with no arguments does not fail elegantly

2 participants