FuelLabs/fuels-ts · error · FuelError
LOG_TYPE_NOT_FOUND
LOG_TYPE_NOT_FOUND
Error message
Log type with logId '${logId}' doesn't exist in the ABI. What it means
Thrown by `Interface.decodeLog` (code `LOG_TYPE_NOT_FOUND`) when no entry in the ABI's `loggedTypes` array has a `logId` equal to the one supplied. The decoder needs the loggedType to know how to decode the log's data, so an unknown logId cannot be processed.
Source
Thrown at packages/abi-coder/src/Interface.ts:66
throw new FuelError(
ErrorCode.FUNCTION_NOT_FOUND,
`function ${nameOrSignatureOrSelector} not found: ${JSON.stringify(fn)}.`
);
}
// Decode the result of a function call
decodeFunctionResult(functionFragment: FunctionFragment | string, data: BytesLike): any {
const fragment =
typeof functionFragment === 'string' ? this.getFunction(functionFragment) : functionFragment;
return fragment.decodeOutput(data);
}
decodeLog(data: BytesLike, logId: string): any {
const loggedType = this.jsonAbiOld.loggedTypes.find((type) => type.logId === logId);
if (!loggedType) {
throw new FuelError(
ErrorCode.LOG_TYPE_NOT_FOUND,
`Log type with logId '${logId}' doesn't exist in the ABI.`
);
}
return AbiCoder.decode(this.jsonAbiOld, loggedType.loggedType, arrayify(data), 0, {
encoding: this.encoding,
});
}
encodeConfigurable(name: string, value: InputValue) {
const configurable = this.jsonAbiOld.configurables.find((c) => c.name === name);
if (!configurable) {
throw new FuelError(
ErrorCode.CONFIGURABLE_NOT_FOUND,
`A configurable with the '${name}' was not found in the ABI.`
);
}View on GitHub (pinned to b3f37c91ac)
Solutions
- Regenerate bindings (`fuels typegen`) from the ABI of the deployed contract and retry.
- Ensure the `Interface`/contract instance used for decoding is the one that emitted the log.
- Inspect `interface.jsonAbiOld.loggedTypes.map(t => t.logId)` to enumerate known logIds.
- If you intentionally receive unknown logs, filter them out before decoding (check `loggedTypes.some(t => t.logId === receipt.logId)`).
Example fix
// before const decoded = iface.decodeLog(receipt.data, receipt.logId); // after — skip logs the ABI doesn't know about const known = iface.jsonAbiOld.loggedTypes.some(t => t.logId === receipt.val); const decoded = known ? iface.decodeLog(receipt.data, receipt.logId) : null;
Defensive patterns
Strategy: validation
Validate before calling
// filter to logs the ABI can decode before calling decodeLog const known = iface.jsonAbiOld.loggedTypes.some((t) => t.logId === receipt.val); const decoded = known ? iface.decodeLog(receipt.data, receipt.val) : null;
Type guard
function isKnownLogId(iface, logId) {
return iface.jsonAbiOld.loggedTypes.some((t) => t.logId === logId);
} Try / catch
try {
const v = iface.decodeLog(receipt.data, receipt.val);
} catch (e) {
if (e.code === 'LOG_TYPE_NOT_FOUND') {
// ABI predates the contract's new log; regenerate and retry
}
throw e;
} Prevention
- Regenerate bindings whenever the contract adds new `log()` statements.
- Decode receipts only with the interface of the contract that emitted them.
- Filter unknown logIds before decoding when consuming receipts from multiple contracts.
When it happens
Trigger: Decoding a log receipt from a contract whose ABI does not declare that log (ABI/bytecode drift); using the wrong contract's ABI to decode receipts; the contract added a new `log` statement after the bindings were generated.
Common situations: Forgetting to regenerate bindings after adding `log()` calls in Sway; decoding receipts from one contract instance with another contract's interface; version mismatch between deployed bytecode and the ABI used in the client.
Related errors
AI-assisted analysis of FuelLabs/fuels-ts@b3f37c91ac (2026-08-12).
Data as JSON: /api/errors/467493c72ae50ddd.
Report an issue: GitHub.