Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unhelpful error when content of a Vyper file is not Vyper #4523

Open
antazoey opened this issue Mar 16, 2025 · 1 comment · May be fixed by #4524
Open

Unhelpful error when content of a Vyper file is not Vyper #4523

antazoey opened this issue Mar 16, 2025 · 1 comment · May be fixed by #4524
Labels
needs triage needs triage

Comments

@antazoey
Copy link
Contributor

Version Information

  • vyper Version (output of vyper --version): 0.4.0
  • OS: macOS
  • Python Version (output of python --version): 3.13.1

What's your issue about?

Weird setup so bear with me.
So I had a bug where I accidentally pasted JSON directly into a Vyper file... like replaced the file's contents, ok.
But that obviously was not compiling by Vyper, which is perfect... However, I had to hunt down the reason why (and eventually find the bug in my code), but the Vyper error was about as helpful as an umbrella on a squid...

Example "contract":

[{"inputs": [],"name": "retrieve","outputs": [{"internalType": "uint256", "name": "", "type": "uint256"}],"stateMutability": "view","type": "function"}]

Compile it:

➜  playground vyper contracts/NotVyper.vy 
AssertionError

How can it be fixed?

Make an actual error telling me I am an idiot

@antazoey antazoey added the needs triage needs triage label Mar 16, 2025
@antazoey
Copy link
Contributor Author

I tracked down the error to this part:

breakpoint()
assert isinstance(file, FileInput)  # mypy hint

tis more than a mypy hint it seems, or validate earlier

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs triage needs triage
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant