Error Codes

Declared in: support/Errors.h

Error codes are returned by various functions to indicate the success or to describe the failure of a requested operation.

All Be error constants except for B_OK (B_NO_ERROR) are negative integers; any function that returns an error code can thus be lazily tested for success or failure by the following:

if ( funcCall() < B_NO_ERROR )
   /* failure*/
else
   /* success*/

All constants (except B_NO_ERROR and B_ERROR) are less than or equal to the value of the B_ERRORS_END constant. If you want to define your own negative-valued error codes, you should begin with the value (B_ERRORS_END + 1) and work your way toward 0.


POSIX Errors

The BeOS supports the POSIX error code constants (these constants start with the letter "E", as in EBADF or ENOENT). A number of Be-defined constants are synonyms for the POSIX constants; for example, the Be equivalent for ENOENT is B_ENTRY_NOT_FOUND.

Most of the General Error Codes, and all the File System Error Codes are covers for POSIX errors. The POSIX equivalents are listed where applicable.

The POSIX constants, and the Be synonyms, can be passed to the POSIX strerror() function. The function, defined in posix/string.h, returns a human-readable description of the error:

char* strerror(int error_code)

General Error Codes

CodePOSIXDescription
B_NO_MEMORYENOMEMThere isn't enough memory for the operation
B_IO_ERROREIOA general input/output error occurred
B_PERMISSION_DENIEDEACCESSIllegal access
B_BAD_INDEX The index is out of range
B_BAD_VALUEEINVALAn illegal value was passed to the function
B_MISMATCHED_VALUES Conflicting values were passed to the function
B_BAD_TYPE An illegal argument type was named or passed
B_NAME_NOT_FOUND There's no match for the specified name.
B_NAME_IN_USE The requested (unique) name is already used
B_BUSYEBUSYA device is busy, or a file is locked
B_NOT_ALLOWEDEPERMOperation not allowed
B_NO_INIT An object or structure isn't properly initialized
B_TIMED_OUTETIMEDOUTTime expired before the operation was finished
B_INTERRUPTEDEINTRA signal interrupted the operation
B_WOULD_BLOCKEAGAINBut you don't want to block
B_WOULD_BLOCKEWOULDBLOCK Same as the above
B_ERROR = -1 A convenient catchall for general errors
B_NO_ERROR = 0 Everything's OK
B_OK Same as B_NO_ERROR

File System Error Codes

CodePOSIXDescription
B_FILE_ERROREBADFA file error occurred
B_FILE_EXISTSEEXISTAnd you don't want to clobber it
B_ENTRY_NOT_FOUNDENOENTThe requested entry doesn't exist
B_NAME_TOO_LONGENAME_TOOLONGLeaf or pathname too long
B_NO_MORE_FDSEMFILENo more file descriptors
B_NOT_A_DIRECTORYENOTDIRWhen it should have been
B_IS_A_DIRECTORYEISDIRWhen it shouldn't be
B_DIRECTORY_NOT_EMPTYENOTEMPTYAttempt to delete a non-empty directory
B_DEVICE_FULLENOSPCFull disk
B_READ_ONLY_DEVICEEROFSWrite request on a read-only file system
B_CROSS_DEVICE_LINKEXDEVHard link across devices not allowed
B_LINK_LIMITELOOPNested links too deep
B_BUSTED_PIPEEPIPEPipe no longer functional.
B_UNSUPPORTED An unsupported operation was attempted.
B_PARTITION_TOO_SMALL A partition is too small for the attempted operation.

Application Kit Error Codes

CodeDescription
B_DUPLICATE_REPLYA reply message has already been sent
B_BAD_REPLYThe reply message is inappropriate and can't be sent
B_BAD_HANDLERThe designated message handler isn't valid
B_MESSAGE_TO_SELFA thread is trying to send a message to itself
B_ALREADY_RUNNINGThe application can't be launched again
B_LAUNCH_FAILEDThe attempt to launch the application failed
B_AMBIGUOUS_APP_LAUNCHOdd things happening in app land
B_UNKOWN_MIME_TYPEApplication signature unknown
B_BAD_SCRIPT_SYNTAXScript syntax malformed
B_LAUNCH_FAILED_NO_RESOLVE_LINKUnable to resolve a link to the application to be launched
B_LAUNCH_FAILED_EXECUTABLEThe attempt to launch the application failed because the application isn't a valid executable
B_LAUNCH_FAILED_APP_NOT_FOUNDThe attempt to launch the application failed because the application wasn't found
B_LAUNCH_FAILED_APP_IN_TRASHThe attempt to launch the application failed because the application was in the trash
B_LAUNCH_FAILED_NO_PREFERRED_APPThe attempt to launch the application failed because there is no preferred application for the document
B_LAUNCH_FAILED_FILES_APP_NOT_FOUNDThe attempt to launch the application failed because the document's application is missing
B_BAD_MIME_SNIFFER_RULEA MIME type sniffer rule is invalid

Kernel Kit Error Codes

CodeDescription
B_BAD_THREAD_IDSpecified thread identifier (thread_id) is invalid
B_BAD_THREAD_STATEThe thread is in the wrong state for the operation
B_NO_MORE_THREADSAll thread identifiers are currently taken
B_BAD_TEAM_IDSpecified team identifier (team_id) is invalid
B_NO_MORE_TEAMSAll team identifiers are currently taken
B_BAD_PORT_IDSpecified port identifier (port_id) is invalid
B_NO_MORE_PORTSAll port identifiers have been taken
B_BAD_SEM_IDSemaphore identifier (sem_id) is invalid
B_NO_MORE_SEMSAll semaphores are currently taken
B_BAD_IMAGE_IDSpecified image identifier (image_id)is invalid
B_NOT_AN_EXECUTABLEAn executable image was expected
B_BAD_ADDRESSIllegal address
B_MISSING_LIBRARYA library needed by an application is missing
B_MISSING_SYMBOLA symbol needed by an application is missing
B_DEBUGGER_ALREADY_INSTALLEDAn attempt was made to install the debugger when it was already installed.

Media Kit Error Codes

CodeDescription
B_MEDIA_SYSTEM_FAILUREThe media system has failed spectacularly
B_MEDIA_BAD_NODEAn invalid or nonexistent node was specified
B_MEDIA_NODE_BUSYThe specified node was busy
B_MEDIA_BAD_FORMATThe specified media_format is invalid
B_MEDIA_TOO_MANY_NODESThe media system has reached its limit of nodes
B_MEDIA_TOO_MANY_BUFFERSThe media system has too many buffers
B_MEDIA_NODE_ALREADY_EXISTSTrying to create a node that already exists is a no-no
B_MEDIA_BUFFER_ALREADY_EXISTSTrying to create a buffer that already exists is a bad idea
B_MEDIA_CANNOT_SEEKA seek failure occurred
B_MEDIA_CANNOT_CHANGE_RUN_MODEUnable to change run mode
B_MEDIA_APP_ALREADY_REGISTEREDAn application has already registered with the media system
B_MEDIA_APP_NOT_REGISTEREDAn application hasn't registered with the media system
B_MEDIA_CANNOT_RECLAIM_BUFFERSReclaiming of BBuffers failed
B_MEDIA_BUFFERS_NOT_RECLAIMEDBBuffers weren't reclaimed
B_MEDIA_TIME_SOURCE_STOPPEDThe time source isn't running
B_MEDIA_TIME_SOURCE_BUSYThe time source is busy
B_MEDIA_BAD_SOURCEThe specified media_source is invalid
B_MEDIA_BAD_DESTINATIONThe specified media_destination is invalid
B_MEDIA_ALREADY_CONNECTEDCan't connect nodes that are already connected
B_MEDIA_NOT_CONNECTEDThere's no connection in place
B_MEDIA_BAD_CLIP_FORMATThe clip format isn't valid
B_MEDIA_ADDON_FAILEDAn add-on failed
B_MEDIA_ADDON_DISABLEDThe add-on is disabled
B_MEDIA_CHANGE_IN_PROGRESSA change is in progress, preventing the requested action
B_MEDIA_STALE_CHANGE_COUNTThe change count is stale
B_MEDIA_ADDON_RESTRICTEDThe add-on is restricted
B_MEDIA_NO_HANDLERThere's no handler available meeting the specified needs
B_MEDIA_DUPLICATE_FORMATThe specified format already exists
B_MEDIA_REALTIME_DISABLEDReal-time memory allocation is disabled
B_MEDIA_REALTIME_UNAVAILABLEReal-time memory allocation isn't available

Mail Error Codes

CodeDescription
B_MAIL_NO_DAEMONmail_daemon not running
B_MAIL_UNKNOWN_USERUser unknown
B_MAIL_WRONG_PASSWORDPassword doesn't match user
B_MAIL_UNKNOWN_HOSTPOP or SMTP host unrecognized
B_MAIL_ACCESS_ERRORCouldn't access host
B_MAIL_UNKNOWN_FIELDUnrecognized message field name
B_MAIL_NO_RECIPIENTReturn to sender, address unknown
B_MAIL_INVALID_MAILInvalid mail invalid mail invalid

Device Kit Error Codes

Code
B_DEV_INVALID_IOCTL
B_DEV_NO_MEMORY
B_DEV_BAD_DRIVE_NUM
B_DEV_NO_MEDIA
B_DEV_UNREADABLE
B_DEV_FORMAT_ERROR
B_DEV_TIMEOUT
B_DEV_RECALIBRATE_ERROR
B_DEV_SEEK_ERROR
B_DEV_ID_ERROR
B_DEV_READ_ERROR
B_DEV_WRITE_ERROR
B_DEV_NOT_READY
B_DEV_MEDIA_CHANGE_REQUESTED
B_DEV_RESOURCE_CONFLICT
B_DEV_CONFIGURATION_ERROR
B_DEV_DISABLED_BY_USER
B_DEV_DOOR_OPEN
Creative Commons License
Legal Notice
This work is licensed under a Creative Commons Attribution-Non commercial-No Derivative Works 3.0 License.