{"record":{"id":"70e9b18cd950fceb","repo":"FuelLabs/fuels-ts","slug":"connection-refused","errorCode":"CONNECTION_REFUSED","errorMessage":"Couldn't connect to the node at \"${providerUrl}\". Check that you've got a node running at the config's providerUrl or set autoStartFuelCore to true.","messagePattern":"Couldn't connect to the node at \"(.+?)\"\\. Check that you've got a node running at the config's providerUrl or set autoStartFuelCore to true\\.","errorType":"exception","errorClass":"FuelError","httpStatus":null,"severity":"error","filePath":"packages/fuels/src/cli/commands/deploy/createWallet.ts","lineNumber":26,"sourceCode":"    pvtKey = privateKey;\n  } else if (process.env.PRIVATE_KEY) {\n    pvtKey = process.env.PRIVATE_KEY;\n  } else {\n    throw new FuelError(\n      FuelError.CODES.MISSING_REQUIRED_PARAMETER,\n      'You must provide a privateKey via config.privateKey or env PRIVATE_KEY'\n    );\n  }\n\n  try {\n    const provider = new Provider(providerUrl);\n    await provider.init(); // can probably be removed\n\n    return Wallet.fromPrivateKey(pvtKey, provider);\n  } catch (e) {\n    const error = e as Error & { cause?: { code: string } };\n    if (/EADDRNOTAVAIL|ECONNREFUSED/.test(error.cause?.code ?? '')) {\n      throw new FuelError(\n        FuelError.CODES.CONNECTION_REFUSED,\n        `Couldn't connect to the node at \"${providerUrl}\". Check that you've got a node running at the config's providerUrl or set autoStartFuelCore to true.`\n      );\n    } else {\n      throw error;\n    }\n  }\n}\n","sourceCodeStart":8,"sourceCodeEnd":35,"githubUrl":"https://github.com/FuelLabs/fuels-ts/blob/b3f37c91aca4aa9d5e4c0d3967f66237190826ea/packages/fuels/src/cli/commands/deploy/createWallet.ts#L8-L35","documentation":"Thrown by createWallet when `new Provider(providerUrl).init()` fails with an EADDRNOTAVAIL or ECONNREFUSED cause. These socket-level errors mean no Fuel node is listening at the configured providerUrl, so the deploy cannot fetch chain state or submit transactions.","triggerScenarios":"Running deploy against a providerUrl where fuel-core is not running, is on a different port, or is unreachable; localhost URL while fuel-core was never started.","commonSituations":"Forgot to start fuel-core locally, wrong port in fuels.config.ts, Docker container not exposed on the expected port, network/firewall blocking the node, autoStartFuelCore left false.","solutions":["Start a local fuel-core node or point providerUrl at a running one.","Set `autoStartFuelCore: true` in fuels.config.ts so the CLI launches a node for you.","Verify the URL and port: curl the /health endpoint before deploying.","Check that Docker/containerized fuel-core publishes the port you configured."],"exampleFix":"// before — fuels.config.ts\nexport default createConfig({ providerUrl: 'http://127.0.0.1:4000', autoStartFuelCore: false });\n// after\nexport default createConfig({ providerUrl: 'http://127.0.0.1:4000', autoStartFuelCore: true });","handlingStrategy":"retry","validationCode":"async function assertNodeReachable(url: string): Promise<void> {\n  const res = await fetch(url + '/health', { signal: AbortSignal.timeout(3000) });\n  if (!res.ok) throw new Error(`node not reachable at ${url}`);\n}","typeGuard":"const isConnectionError = (e: unknown): boolean => {\n  const code = (e as any)?.cause?.code ?? (e as any)?.code;\n  return /EADDRNOTAVAIL|ECONNREFUSED|ENOTFOUND/.test(String(code));\n};","tryCatchPattern":"for (let attempt = 0; attempt < 3; attempt++) {\n  try {\n    return await createWallet(providerUrl, privateKey);\n  } catch (e) {\n    if (!isConnectionError(e) || attempt === 2) throw e;\n  }\n}","preventionTips":["Set autoStartFuelCore: true in dev configs so a local node is guaranteed.","Health-check the node URL before deploy.","Use a stable providerUrl in shared/CI configs."],"tags":["network","cli","deploy","connection","fuel-core"],"backgroundTag":null,"analyzedSha":"b3f37c91aca4aa9d5e4c0d3967f66237190826ea","analyzedAt":"2026-08-12T20:30:56.448Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}