{"record":{"id":"0eb2df9a206afeee","repo":"FuelLabs/fuels-ts","slug":"parse-failed","errorCode":"PARSE_FAILED","errorMessage":"Could not parse name from ABI file: ${filepath}.","messagePattern":"Could not parse name from ABI file: (.+?)\\.","errorType":"exception","errorClass":"FuelError","httpStatus":null,"severity":"error","filePath":"packages/abi-typegen/src/abi/Abi.ts","lineNumber":63,"sourceCode":"    storageSlotsContents?: string;\n    outputDir: string;\n  }) {\n    const {\n      filepath,\n      outputDir,\n      rawContents,\n      hexlifiedBinContents,\n      programType,\n      storageSlotsContents,\n    } = params;\n\n    const abiNameRegex = /([^/]+)-abi\\.json$/m;\n    const abiName = filepath.match(abiNameRegex);\n\n    const couldNotParseName = !abiName || abiName.length === 0;\n\n    if (couldNotParseName) {\n      throw new FuelError(\n        ErrorCode.PARSE_FAILED,\n        `Could not parse name from ABI file: ${filepath}.`\n      );\n    }\n\n    this.programType = programType;\n    this.capitalizedName = `${normalizeString(abiName[1])}`;\n    this.camelizedName = this.capitalizedName.replace(/^./m, (x) => x.toLowerCase());\n\n    this.filepath = filepath;\n    this.rawContents = rawContents;\n    this.hexlifiedBinContents = hexlifiedBinContents;\n    this.storageSlotsContents = storageSlotsContents;\n    this.outputDir = outputDir;\n\n    const { types, functions, configurables, errorCodes } = this.parse();\n\n    this.types = types;","sourceCodeStart":45,"sourceCodeEnd":81,"githubUrl":"https://github.com/FuelLabs/fuels-ts/blob/b3f37c91aca4aa9d5e4c0d3967f66237190826ea/packages/abi-typegen/src/abi/Abi.ts#L45-L81","documentation":"Abi constructor derives the contract/script/predicate class name from the ABI filepath using the regex /([^/]+)-abi\\.json$/m. The captured group becomes the capitalized name. If the filepath does not end in `-abi.json` (with that exact suffix) the regex yields no match and the type generator cannot name the output.","triggerScenarios":"Passing an ABI filepath whose basename is not of the form `<Name>-abi.json` (e.g. `myabi.json`, `Foo.json`, `Foo-abi.ts`); passing a path with no basename match.","commonSituations":"Renaming ABI files away from the `-abi.json` convention; pointing typegen at downloaded ABIs that lost the suffix; cross-platform path separators altering the basename.","solutions":["Rename the ABI file to follow the `<PascalName>-abi.json` convention (e.g. `MyContract-abi.json`).","If files are user-supplied, normalize/rename them before invoking AbiTypeGen.","Confirm the filepath passed to Abi is the full path ending in `-abi.json`."],"exampleFix":"# before\nfuels typegen -i ./abis/MyContract.json ...\n\n# after\nfuels typegen -i ./abis/MyContract-abi.json ...","handlingStrategy":"validation","validationCode":"function assertAbiFilename(filepath: string) {\n  if (!/[^/]+-abi\\.json$/m.test(filepath)) {\n    throw new Error(`ABI file must end in '-abi.json': ${filepath}`);\n  }\n}","typeGuard":"function isAbiFilename(filepath: string): boolean {\n  return /[^/]+-abi\\.json$/m.test(filepath);\n}","tryCatchPattern":null,"preventionTips":["Adopt the `<Name>-abi.json` naming convention across the project.","Validate filenames before invoking AbiTypeGen.","Keep ABI/BIN filename stems aligned."],"tags":["typegen","parse-failed","filename","convention"],"backgroundTag":null,"analyzedSha":"b3f37c91aca4aa9d5e4c0d3967f66237190826ea","analyzedAt":"2026-08-12T20:30:56.448Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}