Blockchain 3 min read

Fix the “mock compiler: source not found” Error in Remix Solidity

When compiling a Solidity contract in Remix, the “mock compiler: source not found” error occurs because the compiler version isn’t specified, and the guide shows how to set the correct version in Remix settings or directly via the URL, plus tips for spotting low‑level syntax mistakes.

Senior Brother's Insights
Senior Brother's Insights
Senior Brother's Insights
Fix the “mock compiler: source not found” Error in Remix Solidity
First‑time users of Remix for Solidity smart‑contract development may encounter the “mock compiler: source not found” error, which prevents compilation.

Problem

After writing a contract and clicking compile, Remix shows a message like “mock compiler: source not found”. This happens because the Solidity compiler version has not been set in the Remix URL (e.g., https://remix.ethereum.org/#optimize=true&version=builtin lacks a version parameter).

Solution

In the right‑hand panel, open Settings and under “Select new compiler version” choose the appropriate Solidity version. Remix will automatically add a version parameter to the URL.

If you already know the exact version, you can append version=0.8.17 (or any desired version) directly to the URL. Different versions support different syntax features, so choose according to your contract’s requirements.

Low‑Level Errors That Trigger the Same Exception

Sometimes the error is caused by a simple syntax mistake, such as forgetting a semicolon after the pragma line when copying code from elsewhere.

Solidity:ParserError: Expected pragma, import directive or contract/interface/library definition.

Inspect the contract for missing semicolons or other basic syntax errors to resolve the issue.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

DebuggingBlockchainsmart contractsSolidityRemixCompiler Error
Senior Brother's Insights
Written by

Senior Brother's Insights

A public account focused on workplace, career growth, team management, and self-improvement. The author is the writer of books including 'SpringBoot Technology Insider' and 'Drools 8 Rule Engine: Core Technology and Practice'.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.