{"record":{"id":"20e7e8828e95d115","repo":"FuelLabs/fuels-ts","slug":"config-file-not-found-20e7e8","errorCode":"CONFIG_FILE_NOT_FOUND","errorMessage":"Config file not found!","messagePattern":"Config file not found!","errorType":"exception","errorClass":"FuelError","httpStatus":null,"severity":"error","filePath":"packages/fuels/src/cli/config/loadConfig.ts","lineNumber":26,"sourceCode":"import { tryFindBinaries } from '../../cli-utils';\nimport type { FuelsConfig, UserFuelsConfig } from '../types';\n\nimport { SwayType, readForcToml, readSwayType } from './forcUtils';\nimport { validateConfig } from './validateConfig';\n\nexport async function loadUserConfig(\n  cwd: string\n): Promise<{ userConfig: UserFuelsConfig; configPath: string }> {\n  const configJoycon = new JoyCon();\n\n  const configPath = await configJoycon.resolve({\n    files: ['ts', 'js', 'cjs', 'mjs'].map((e) => `fuels.config.${e}`),\n    cwd,\n    stopDir: parse(cwd).root,\n  });\n\n  if (!configPath) {\n    throw new FuelError(FuelError.CODES.CONFIG_FILE_NOT_FOUND, 'Config file not found!');\n  }\n\n  const esbuildOptions: BuildOptions = {\n    target: 'ES2021',\n    platform: 'node',\n    format: 'esm',\n  };\n\n  const result = await bundleRequire({\n    filepath: configPath,\n    esbuildOptions,\n    cwd,\n  });\n\n  const userConfig: UserFuelsConfig = result.mod.default;\n  return { configPath, userConfig };\n}\n","sourceCodeStart":8,"sourceCodeEnd":44,"githubUrl":"https://github.com/FuelLabs/fuels-ts/blob/b3f37c91aca4aa9d5e4c0d3967f66237190826ea/packages/fuels/src/cli/config/loadConfig.ts#L8-L44","documentation":"Thrown by loadUserConfig when JoyCon cannot resolve any fuels.config.{ts,js,cjs,mjs} walking up from cwd to the filesystem root. The CLI requires a config to know what to build or deploy, so it aborts when none is found.","triggerScenarios":"Running `fuels build` / `fuels deploy` / other fuels commands from a directory tree that contains no fuels.config.* file.","commonSituations":"Running fuels before `fuels init`, wrong cwd (e.g. inside a package subfolder rather than the project root), config file named differently.","solutions":["Run `fuels init` first to generate fuels.config.ts.","Make sure you invoke fuels from the directory containing fuels.config.ts (or an ancestor of it that JoyCon can walk to — note JoyCon walks up from cwd).","Rename/move your config so it matches the expected filename."],"exampleFix":"// before\nfuels build   # no fuels.config.ts in tree\n// after\nfuels init\nfuels build","handlingStrategy":"validation","validationCode":"import { existsSync } from 'fs';\nconst fuelsConfigPresent = (cwd: string): boolean =>\n  ['ts', 'js', 'cjs', 'mjs'].some((e) => existsSync(`${cwd}/fuels.config.${e}`));","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run `fuels init` before any other fuels command.","Invoke fuels from the project root containing fuels.config.ts.","Add a precheck in CI that the config exists before building."],"tags":["cli","config","init","filesystem"],"backgroundTag":null,"analyzedSha":"b3f37c91aca4aa9d5e4c0d3967f66237190826ea","analyzedAt":"2026-08-12T20:30:56.448Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}