Skip to content

Fix package resolution error to include file path (Fixes #1797) - #1799

Merged
kevmoo merged 1 commit into
dart-lang:mainfrom
NamanGoyalK:fix-issue-1797
Feb 14, 2026
Merged

kevmoo merged 1 commit into
dart-lang:mainfrom
NamanGoyalK:fix-issue-1797

Conversation

@NamanGoyalK

Copy link
Copy Markdown
Contributor

Fixes #1797

When analysis_options.yaml fails to resolve a package URI in an include, the current error message does not indicate which file triggered the error. This makes debugging difficult in mono-repos with multiple analysis option files.

This PR adds the file path (optionsPath) to the PackageResolutionException message.

Changes:

  • Updated readAnalysisOptions to include $optionsPath in exception messages.
  • Updated analysis_options_file_test.dart to verify the path is present in the error string.

Output:

  • Before: Failed to resolve package URI "..." in include.
  • After: Failed to resolve package URI "..." in include at "path/to/analysis_options.yaml".

  • I’ve reviewed the contributor guide and applied the relevant portions to this PR.

@kevmoo
kevmoo requested a review from munificent February 12, 2026 17:35
@kevmoo

kevmoo commented Feb 12, 2026

Copy link
Copy Markdown
Member

Nice fix! Will let @munificent take a look

@NamanGoyalK

Copy link
Copy Markdown
Contributor Author

Hi @kevmoo, I've updated analysis_options_file.dart to bring the new error messages within the 80-character limit. Local analysis with dart analyze --fatal-infos now passes for this specific file.

The remaining CI failures appear to be pre-existing use_null_aware_elements issues in files I haven't touched (like ast_extensions.dart and piece_factory.dart). Should I include a cleanup for those in this PR, or would you prefer to keep this strictly focused on the package resolution fix?

@kevmoo

kevmoo commented Feb 13, 2026

Copy link
Copy Markdown
Member

#1804 for the lint fix

feel free to just base your PR on mine if you want

@kevmoo

kevmoo commented Feb 13, 2026

Copy link
Copy Markdown
Member

or just rebase on master – fix landed!

@NamanGoyalK

Copy link
Copy Markdown
Contributor Author

Rebased on master to include the recent lint fixes. Local analysis is now passing.

@kevmoo kevmoo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think this is straightforward enough for me to land. Thanks for making errors better!

@kevmoo

kevmoo commented Feb 14, 2026

Copy link
Copy Markdown
Member

Ha! Don't forget to format the formatter!

@NamanGoyalK

Copy link
Copy Markdown
Contributor Author

@kevmoo ran the format command! :]

@NamanGoyalK
NamanGoyalK requested a review from kevmoo February 14, 2026 14:59
@kevmoo

kevmoo commented Feb 14, 2026

Copy link
Copy Markdown
Member

pro tip: avoid force pushing when reviews have happened. Often folks want to see the delta between reviews!

@kevmoo
kevmoo merged commit 0d56d85 into dart-lang:main Feb 14, 2026
8 checks passed
@NamanGoyalK

Copy link
Copy Markdown
Contributor Author

Got it @kevmoo! I actually thought it was the opposite, but thanks for the lesson, that makes total sense for the review process. Feel free to tag or assign me to any other issues you think would be a good fit. Happy to help out more! :]

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.

"Failed to resolve package URI" thrown when running in a mono repo

2 participants