Skip to content

Improve HHE909 error message to show incompatible files Fixes #7748#7757

Closed
sanskar717 wants to merge 5 commits intoNomicFoundation:mainfrom
sanskar717:fix/improve-hhe909-error-message
Closed

Improve HHE909 error message to show incompatible files Fixes #7748#7757
sanskar717 wants to merge 5 commits intoNomicFoundation:mainfrom
sanskar717:fix/improve-hhe909-error-message

Conversation

@sanskar717
Copy link
Copy Markdown

@sanskar717 sanskar717 commented Dec 7, 2025

Description

Improves the HHE909 error message to show which files have incompatible Solidity version requirements, making it easier to diagnose version compatibility issues in projects with large dependency trees.

Problem

When a file can't be compiled due to version pragma incompatibilities deep in its dependency tree, the error message only says "No solc version enabled in this profile is compatible with this file and all of its dependencies" - without telling you which files are actually causing the problem.

This makes debugging extremely difficult, especially in projects with large dependency trees where the incompatible pragma could be buried several levels down.

Solution

The improved error message now displays:

  • ✅ Which specific files have incompatible version requirements
  • ✅ The exact version pragma for each incompatible file
  • ✅ Available compiler versions from the config
  • ✅ A count of remaining files if there are more than 5 (to keep output manageable)

Changes Made

  • Added detailed file information to HHE909 error output
  • Shows version pragma for each incompatible file
  • Displays available compiler versions for reference
  • Limits display to first 5 files with indicator of total count
  • Improves developer experience when troubleshooting Solidity version issues

Related Issue

Fixes #7748

Testing

Tested with projects having:

  • Single incompatible file in dependency tree
  • Multiple incompatible files
  • Large dependency trees (verified output is bounded to 5 files)

Checklist

  • Changes follow the existing code style
  • Tests added/updated (if applicable)
  • Documentation updated (if applicable)
  • No breaking changes

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Dec 7, 2025

🦋 Changeset detected

Latest commit: 4a8f9ae

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
hardhat Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@sanskar717
Copy link
Copy Markdown
Author

Summary

This PR improves the HHE909 error message by showing which specific files have incompatible Solidity version requirements, making debugging much easier.

Testing Evidence

Here's the improved error output in action:

[
image
]

Before vs After

Before: ❌ Only showed "No solc version enabled" without details
After: ✅ Shows exactly which file (./contracts/IFoo.sol) requires what version (0.8.28)

Why This Helps

  • Developers immediately see the problematic file
  • No need to manually trace dependency trees
  • Available versions clearly listed for reference
  • Perfect for large projects with complex dependencies

Testing Verified

  • ✅ Single incompatible file in dependency tree
  • ✅ Multiple incompatible files
  • ✅ Large dependency trees (output capped to 5 files)

@@ -0,0 +1,178 @@
port { defineConfig } from "hardhat/config";
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 file was included by accident.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

@kanej Yes, you're correct - that was included by mistake. Should I remove it from this PR?

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.

Yes, I don't seem to have push permissions to your branch.

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.

Can you add a changeset as well?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

@kanej Sure, I'll add a changeset. Just to confirm - should I run npx changeset in the root directory and document the improved error message changes?

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.

That would be great, thanks!

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

@kanej Changeset added! Thank you for your guidance and patience throughout this process. Looking forward to your review!

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

@kanej Hi! Just a quick follow-up — would you mind taking another look at this PR when you have time?
If everything looks correct and helpful on your end, I’d really appreciate a merge. Thanks again for your guidance!

@kanej
Copy link
Copy Markdown
Member

kanej commented Jan 7, 2026

I was able to run the changes locally, based on the repro steps from #7748:

image

@kanej kanej added no docs needed This PR doesn't require links to documentation and removed status:triaging labels Jan 7, 2026
Removed hardhat.config.ts.save file that was included by mistake as pointed out in the review.
sanskar717 and others added 3 commits January 8, 2026 17:01
…tem/solc-config-selection.ts

Co-authored-by: John Kane <john@kanej.me>
…tem/solc-config-selection.ts

Co-authored-by: John Kane <john@kanej.me>
@alcuadrado
Copy link
Copy Markdown
Member

Hey, sorry we didn't get this past the finish line, @sanskar717. Unfortunately we were also working on a slightly different approach, which you can take a look at #7988

@alcuadrado alcuadrado closed this Feb 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no docs needed This PR doesn't require links to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve error message when no solc version is compatible with a file

4 participants