Skip to main content

Common Script Error Code

CKB defines some basic error codes:

No.Error codeDiscription
1CKB_INDEX_OUT_OF_BOUNDAll indices of the specified type have been fetched.
2CKB_ITEM_MISSINGThe requested entity is not present, such as fetching a Type Script from a cell that doesn’t have one.
3CKB_LENGTH_NOT_ENOUGHThe data length is invalid, such as incorrect script arguments or signature length.
4CKB_INVALID_DATAError in molecule serialization.
5CKB_WAIT_FAILUREThe file descriptor is invalid during syscall Wait.
6CKB_INVALID_FDThe file descriptor is not owned by this process.
7CKB_OTHER_END_CLOSEDThe other end of the pipe is closed.
8CKB_MAX_VMS_SPAWNEDThe maximum count of spawned processes has been reached.
9CKB_MAX_FDS_CREATEDThe maximum count of created pipes has been reached.

In scenarios where read, write, or wait operations block each other, the system could enter a deadlock state. In such cases, CKB-VM will throw an internal error and terminate immediately.

Molecule Error Codes from CKB standard C library

#define MOL2_ERR_TOTAL_SIZE 0x01
#define MOL2_ERR_HEADER 0x02
#define MOL2_ERR_OFFSET 0x03
#define MOL2_ERR_UNKNOWN_ITEM 0x04
#define MOL2_ERR_INDEX_OUT_OF_BOUNDS 0x05
#define MOL2_ERR_FIELD_COUNT 0x06
#define MOL2_ERR_DATA 0x07
#define MOL2_ERR_OVERFLOW 0x08

Error codes from common scripts via ckb-script-error-codes