Troubleshooting
This section describes a few common errors you may hit while experimenting with the examples.
This isn't a comprehensive list of problems! It's meant as a starting point to help you get familiar with Cubist tools. If you need help, reach out over discord or at [email protected].
index
module not found (JavaScript)
Error [ERR_MODULE_NOT_FOUND]: Cannot find module '.../build/orm/index.js' imported from '.../src/deploy.js'
This error happens if you haven't run cubist build
before trying to
interact with or deploy your contracts. That's because cubist build
automatically generates the ORM code (index.js
) that (in this case)
src/deploy.js
relies on.
File not found for module (Rust)
Compiling template-TokenBridge-Rust v0.1.0 (.../TokenBridge/Rust)
error[E0583]: file not found for module `cubist_gen`
--> src/main.rs:3:1
|
3 | mod cubist_gen;
| ^^^^^^^^^^^^^^^
... many more...
This error happens if you haven't run cubist build
before trying to
interact with or deploy your contracts. That's because cubist build
automatically generates the code (src/cubist_gen.rs
and src/cubist_gen/
)
the off-chain code relies on. You will also get this error if you've
removed the Cubist-generated files but forgotten to run cubist build
again (e.g., after changing your smart contracts).
Could not detect network (JavaScript)
> [email protected] deploy
> node ./src/deploy.js
Deploying!
Error: could not detect network (event="noNetwork", code=NETWORK_ERROR, version=providers/5.7.2)
You may encounter this error if you haven't used Cubist to start the
local chains. The deploy scripts needs the chains up in order to access
them over the network for deployment. Running cubist start
to start
both the chains and the relayer before deploying your contracts should
fix this issue.
Contracts not deployed (Rust)
Error:
0: Contracts not deployed; call 'deploy' first
1: No deployment receipts found for contract 'TokenSender.sol:TokenSender' on target polygon
Location:
src/cli.rs:287
As the error explains, this happens if you haven't deployed your contracts before trying to use them. Deploy and try again.
Invalid account or address (JavaScript)
> [email protected] buy
> node ./src/buy.js
.../src/buy.js:73
throw new Error(`Invalid account or address: ${accountOrAddress}`);
^
Error: Invalid account or address: 3
You may see this if you haven't deployed your contracts before trying
to use them. In this case, the "account or address" is invalid because
the contract hasn't been deployed yet. Deploying your contracts
(e.g., npm run deploy
) should fix this error.
Failed to connect to target (Rust)
Error:
0: Failed to connect to target 'polygon' at http://localhost:9545/
1: ProviderError when calling 'get_accounts': error sending request for url (http://localhost:9545/): error trying to connect: tcp connect error: Connection refused (os error 61)
Location:
src/cli.rs:108
You will see this if you haven't used Cubist to start the local chains.
To fix it, start the chains and the Cubist relayer with cubist start
before deploying and interacting with your contracts.
Error reading compilation manifest (Cubist)
Launching chains
ethereum ✔ [ 0s] [....................] http://localhost:8545/
polygon ✔ [ 1s] [....................] http://localhost:9545/
All servers available
Error:
0: Error reading compilation manifest for target 'ethereum'. Did you run 'cubist pre-compile'?
1: Failed to read pre-compile manifest file. Path: /cubist-sdk-templates/TokenBridge/JavaScript/build/ethereum/contracts/cubist-manifest.json
2: No such file or directory (os error 2)
You did not run cubist build
before starting the Cubist relayer. The
Cubist relayer relies on information generated at build time; it cannot
operate without access to data in the build
directory. Running cubist
build
before running cubist start
(or cubist start relayer
) should
fix this problem.
Already running Cubist (Cubist)
Already running cubist:3719. Run 'cubist stop' first if you want to restart.
You've tried to run cubist start
, but the chains and relayer are
already running. If you want to re-start Cubist,
run cubist stop
first (as the error message says).
Contract already deployed (JavaScript)
Error: TokenSender was already deployed. Multiple deployments coming soon.
at ContractFactory.deploy (...)
at deploy (...)
You've already deployed your contracts; multiple deployments
of the same contract is not currently supported in the Node SDK. If
you want to re-deploy your contract from scratch, remove the Cubist-generated
deploy
directory and try again.
If you're interested in deploying the same contract multiple times using the Node SDK, contact us at [email protected] or on discord. This behavior is supported in Rust!