# Error Codes
Author: Arvid Norberg, arvid@rasterbar.com

Author: | Arvid Norberg, arvid@rasterbar.com
Version: | 1.0.0

Table of contents

- libtorrent_exception

# libtorrent_exception

Declared in "libtorrent/error_code.hpp"

    struct libtorrent_exception: std::exception
    {
       error_code error () const;
       virtual ~libtorrent_exception () throw();
       libtorrent_exception (error_code const& s);
       virtual const char* what () const throw();
    };

## get_libtorrent_category()

Declared in "libtorrent/error_code.hpp"

    boost::system::error_category& get_libtorrent_category ();

return the instance of the libtorrent_error_category which maps libtorrent error codes to human readable error messages.

## get_http_category()

Declared in "libtorrent/error_code.hpp"

    boost::system::error_category& get_http_category ();

returns the error_category for HTTP errors

## get_i2p_category()

Declared in "libtorrent/i2p_stream.hpp"

    boost::system::error_category& get_i2p_category ();

returns the error category for I2P errors

## get_bdecode_category()

Declared in "libtorrent/lazy_entry.hpp"

    boost::system::error_category& get_bdecode_category ();

get the `error_category` for bdecode errors

## get_socks_category()

Declared in "libtorrent/socks5_stream.hpp"

    boost::system::error_category& get_socks_category ();

returns the error_category for SOCKS5 errors

## get_upnp_category()

Declared in "libtorrent/upnp.hpp"

    boost::system::error_category& get_upnp_category ();

## enum error_code_enum

Declared in "libtorrent/error_code.hpp"

name | value | description
--- | --- | ---
no_error | 0 | Not an error
file_collision | 1 | Two torrents has files which end up overwriting each other
failed_hash_check | 2 | A piece did not match its piece hash
torrent_is_no_dict | 3 | The .torrent file does not contain a bencoded dictionary at its top level
torrent_missing_info | 4 | The .torrent file does not have an `info` dictionary
torrent_info_no_dict | 5 | The .torrent file's `info` entry is not a dictionary
torrent_missing_piece_length | 6 | The .torrent file does not have a `piece length` entry
torrent_missing_name | 7 | The .torrent file does not have a `name` entry
torrent_invalid_name | 8 | The .torrent file's name entry is invalid
torrent_invalid_length | 9 | The length of a file, or of the whole .torrent file is invalid. Either negative or not an integer
torrent_file_parse_failed | 10 | Failed to parse a file entry in the .torrent
torrent_missing_pieces | 11 | The `pieces` field is missing or invalid in the .torrent file
torrent_invalid_hashes | 12 | The `pieces` string has incorrect length
too_many_pieces_in_torrent | 13 | The .torrent file has more pieces than is supported by libtorrent
invalid_swarm_metadata | 14 | The metadata (.torrent file) that was received from the swarm matched the info-hash, but failed to be parsed
invalid_bencoding | 15 | The file or buffer is not correctly bencoded
no_files_in_torrent | 16 | The .torrent file does not contain any files
invalid_escaped_string | 17 | The string was not properly url-encoded as expected
session_is_closing | 18 | Operation is not permitted since the session is shutting down
duplicate_torrent | 19 | There's already a torrent with that info-hash added to the session
invalid_torrent_handle | 20 | The supplied torrent_handle is not referring to a valid torrent
invalid_entry_type | 21 | The type requested from the entry did not match its type
missing_info_hash_in_uri | 22 | The specified URI does not contain a valid info-hash
file_too_short | 23 | One of the files in the torrent was unexpectadly small. This might be caused by files being changed by an external process
unsupported_url_protocol | 24 | The URL used an unknown protocol. Currently `http` and `https` (if built with openssl support) are recognized. For trackers `udp` is recognized as well.
url_parse_error | 25 | The URL did not conform to URL syntax and failed to be parsed
peer_sent_empty_piece | 26 | The peer sent a 'piece' message of length 0
parse_failed | 27 | A bencoded structure was currupt and failed to be parsed
invalid_file_tag | 28 | The fast resume file was missing or had an invalid file version tag
missing_info_hash | 29 | The fast resume file was missing or had an invalid info-hash
mismatching_info_hash | 30 | The info-hash did not match the torrent
invalid_hostname | 31 | The URL contained an invalid hostname
invalid_port | 32 | The URL had an invalid port
port_blocked | 33 | The port is blocked by the port-filter, and prevented the connection
expected_close_bracket_in_address | 34 | The IPv6 address was expected to end with ']'
destructing_torrent | 35 | The torrent is being destructed, preventing the operation to succeed
timed_out | 36 | The connection timed out
upload_upload_connection | 37 | The peer is upload only, and we are upload only. There's no point in keeping the connection
uninteresting_upload_peer | 38 | The peer is upload only, and we're not interested in it. There's no point in keeping the connection
invalid_info_hash | 39 | The peer sent an unknown info-hash
torrent_paused | 40 | The torrent is paused, preventing the operation from succeeding
invalid_have | 41 | The peer sent an invalid have message, either wrong size or referring to a piece that doesn't exist in the torrent
invalid_bitfield_size | 42 | The bitfield message had the incorrect size
too_many_requests_when_choked | 43 | The peer kept requesting pieces after it was choked, possible abuse attempt.
invalid_piece | 44 | The peer sent a piece message that does not correspond to a piece request sent by the client
no_memory | 45 | memory allocation failed
torrent_aborted | 46 | The torrent is aborted, preventing the operation to succeed
self_connection | 47 | The peer is a connection to ourself, no point in keeping it
invalid_piece_size | 48 | The peer sent a piece message with invalid size, either negative or greater than one block
timed_out_no_interest | 49 | The peer has not been interesting or interested in us for too long, no point in keeping it around
timed_out_inactivity | 50 | The peer has not said anything in a long time, possibly dead
timed_out_no_handshake | 51 | The peer did not send a handshake within a reasonable amount of time, it might not be a bittorrent peer
timed_out_no_request | 52 | The peer has been unchoked for too long without requesting any data. It might be lying about its interest in us
invalid_choke | 53 | The peer sent an invalid choke message
invalid_unchoke | 54 | The peer send an invalid unchoke message
invalid_interested | 55 | The peer sent an invalid interested message
invalid_not_interested | 56 | The peer sent an invalid not-interested message
invalid_request | 57 | The peer sent an invalid piece request message
invalid_hash_list | 58 | The peer sent an invalid hash-list message (this is part of the merkle-torrent extension)
invalid_hash_piece | 59 | The peer sent an invalid hash-piece message (this is part of the merkle-torrent extension)
invalid_cancel | 60 | The peer sent an invalid cancel message
invalid_dht_port | 61 | The peer sent an invalid DHT port-message
invalid_suggest | 62 | The peer sent an invalid suggest piece-message
invalid_have_all | 63 | The peer sent an invalid have all-message
invalid_have_none | 64 | The peer sent an invalid have none-message
invalid_reject | 65 | The peer sent an invalid reject message
invalid_allow_fast | 66 | The peer sent an invalid allow fast-message
invalid_extended | 67 | The peer sent an invalid extesion message ID
invalid_message | 68 | The peer sent an invalid message ID
sync_hash_not_found | 69 | The synchronization hash was not found in the encrypted handshake
invalid_encryption_constant | 70 | The encryption constant in the handshake is invalid
no_plaintext_mode | 71 | The peer does not support plaintext, which is the selected mode
no_rc4_mode | 72 | The peer does not support rc4, which is the selected mode
unsupported_encryption_mode | 73 | The peer does not support any of the encryption modes that the client supports
unsupported_encryption_mode_selected | 74 | The peer selected an encryption mode that the client did not advertise and does not support
invalid_pad_size | 75 | The pad size used in the encryption handshake is of invalid size
invalid_encrypt_handshake | 76 | The encryption handshake is invalid
no_incoming_encrypted | 77 | The client is set to not support incoming encrypted connections and this is an encrypted connection
no_incoming_regular | 78 | The client is set to not support incoming regular bittorrent connections, and this is a regular connection
duplicate_peer_id | 79 | The client is already connected to this peer-ID
torrent_removed | 80 | Torrent was removed
packet_too_large | 81 | The packet size exceeded the upper sanity check-limit
reserved | 82 |
http_error | 83 | The web server responded with an error
missing_location | 84 | The web server response is missing a location header
invalid_redirection | 85 | The web seed redirected to a path that no longer matches the .torrent directory structure
redirecting | 86 | The connection was closed becaused it redirected to a different URL
invalid_range | 87 | The HTTP range header is invalid
no_content_length | 88 | The HTTP response did not have a content length
banned_by_ip_filter | 89 | The IP is blocked by the IP filter
too_many_connections | 90 | At the connection limit
peer_banned | 91 | The peer is marked as banned
stopping_torrent | 92 | The torrent is stopping, causing the operation to fail
too_many_corrupt_pieces | 93 | The peer has sent too many corrupt pieces and is banned
torrent_not_ready | 94 | The torrent is not ready to receive peers
peer_not_constructed | 95 | The peer is not completely constructed yet
session_closing | 96 | The session is closing, causing the operation to fail
optimistic_disconnect | 97 | The peer was disconnected in order to leave room for a potentially better peer
torrent_finished | 98 | The torrent is finished
no_router | 99 | No UPnP router found
metadata_too_large | 100 | The metadata message says the metadata exceeds the limit
invalid_metadata_request | 101 | The peer sent an invalid metadata request message
invalid_metadata_size | 102 | The peer advertised an invalid metadata size
invalid_metadata_offset | 103 | The peer sent a message with an invalid metadata offset
invalid_metadata_message | 104 | The peer sent an invalid metadata message
pex_message_too_large | 105 | The peer sent a peer exchange message that was too large
invalid_pex_message | 106 | The peer sent an invalid peer exchange message
invalid_lt_tracker_message | 107 | The peer sent an invalid tracker exchange message
too_frequent_pex | 108 | The peer sent an pex messages too often. This is a possible attempt of and attack
no_metadata | 109 | The operation failed because it requires the torrent to have the metadata (.torrent file) and it doesn't have it yet. This happens for magnet links before they have downloaded the metadata, and also torrents added by URL.
invalid_dont_have | 110 | The peer sent an invalid `dont_have` message. The dont have message is an extension to allow peers to advertise that the no longer has a piece they previously had.
requires_ssl_connection | 111 | The peer tried to connect to an SSL torrent without connecting over SSL.
invalid_ssl_cert | 112 | The peer tried to connect to a torrent with a certificate for a different torrent.
not_an_ssl_torrent | 113 | the torrent is not an SSL torrent, and the operation requires an SSL torrent
unsupported_protocol_version | 120 | The NAT-PMP router responded with an unsupported protocol version
natpmp_not_authorized | 121 | You are not authorized to map ports on this NAT-PMP router
network_failure | 122 | The NAT-PMP router failed because of a network failure
no_resources | 123 | The NAT-PMP router failed because of lack of resources
unsupported_opcode | 124 | The NAT-PMP router failed because an unsupported opcode was sent
missing_file_sizes | 130 | The resume data file is missing the 'file sizes' entry
no_files_in_resume_data | 131 | The resume data file 'file sizes' entry is empty
missing_pieces | 132 | The resume data file is missing the 'pieces' and 'slots' entry
mismatching_number_of_files | 133 | The number of files in the resume data does not match the number of files in the torrent
mismatching_file_size | 134 | One of the files on disk has a different size than in the fast resume file
mismatching_file_timestamp | 135 | One of the files on disk has a different timestamp than in the fast resume file
not_a_dictionary | 136 | The resume data file is not a dictionary
invalid_blocks_per_piece | 137 | The 'blocks per piece' entry is invalid in the resume data file
missing_slots | 138 | The resume file is missing the 'slots' entry, which is required for torrents with compact allocation
too_many_slots | 139 | The resume file contains more slots than the torrent
invalid_slot_list | 140 | The 'slot' entry is invalid in the resume data
invalid_piece_index | 141 | One index in the 'slot' list is invalid
pieces_need_reorder | 142 | The pieces on disk needs to be re-ordered for the specified allocation mode. This happens if you specify sparse allocation and the files on disk are using compact storage. The pieces needs to be moved to their right position
http_parse_error | 150 | The HTTP header was not correctly formatted
http_missing_location | 151 | The HTTP response was in the 300-399 range but lacked a location header
http_failed_decompress | 152 | The HTTP response was encoded with gzip or deflate but decompressing it failed
no_i2p_router | 160 | The URL specified an i2p address, but no i2p router is configured
scrape_not_available | 170 | The tracker URL doesn't support transforming it into a scrape URL. i.e. it doesn't contain "announce.
invalid_tracker_response | 171 | invalid tracker response
invalid_peer_dict | 172 | invalid peer dictionary entry. Not a dictionary
tracker_failure | 173 | tracker sent a failure message
invalid_files_entry | 174 | missing or invalid 'files' entry
invalid_hash_entry | 175 | missing or invalid 'hash' entry
invalid_peers_entry | 176 | missing or invalid 'peers' and 'peers6' entry
invalid_tracker_response_length | 177 | udp tracker response packet has invalid size
invalid_tracker_transaction_id | 178 | invalid transaction id in udp tracker response
invalid_tracker_action | 179 | invalid action field in udp tracker response
error_code_max | 180 | the number of error codes

## enum http_errors

Declared in "libtorrent/error_code.hpp"

name | value | description
--- | --- | ---
cont | 100 |
ok | 200 |
created | 201 |
accepted | 202 |
no_content | 204 |
multiple_choices | 300 |
moved_permanently | 301 |
moved_temporarily | 302 |
not_modified | 304 |
bad_request | 400 |
unauthorized | 401 |
forbidden | 403 |
not_found | 404 |
internal_server_error | 500 |
not_implemented | 501 |
bad_gateway | 502 |
service_unavailable | 503 |

## enum i2p_error_code

Declared in "libtorrent/i2p_stream.hpp"

name | value | description
--- | --- | ---
no_error | 0 |
parse_failed | 1 |
cant_reach_peer | 2 |
i2p_error | 3 |
invalid_key | 4 |
invalid_id | 5 |
timeout | 6 |
key_not_found | 7 |
duplicated_id | 8 |
num_errors | 9 |

## enum error_code_enum

Declared in "libtorrent/lazy_entry.hpp"

name | value | description
--- | --- | ---
no_error | 0 | Not an error
expected_string | 1 | expected string in bencoded string
expected_colon | 2 | expected colon in bencoded string
unexpected_eof | 3 | unexpected end of file in bencoded string
expected_value | 4 | expected value (list, dict, int or string) in bencoded string
depth_exceeded | 5 | bencoded recursion depth limit exceeded
limit_exceeded | 6 | bencoded item count limit exceeded
overflow | 7 | integer overflow
error_code_max | 8 | the number of error codes

## enum socks_error_code

Declared in "libtorrent/socks5_stream.hpp"

name | value | description
--- | --- | ---
no_error | 0 |
unsupported_version | 1 |
unsupported_authentication_method | 2 |
unsupported_authentication_version | 3 |
authentication_error | 4 |
username_required | 5 |
general_failure | 6 |
command_not_supported | 7 |
no_identd | 8 |
identd_error | 9 |
num_errors | 10 |

## enum error_code_enum

Declared in "libtorrent/upnp.hpp"

name | value | description
--- | --- | ---
no_error | 0 | No error
invalid_argument | 402 | One of the arguments in the request is invalid
action_failed | 501 | The request failed
value_not_in_array | 714 | The specified value does not exist in the array
source_ip_cannot_be_wildcarded | 715 | The source IP address cannot be wild-carded, but must be fully specified
external_port_cannot_be_wildcarded | 716 | The external port cannot be wildcarded, but must be specified
port_mapping_conflict | 718 | The port mapping entry specified conflicts with a mapping assigned previously to another client
internal_port_must_match_external | 724 | Internal and external port value must be the same
only_permanent_leases_supported | 725 | The NAT implementation only supports permanent lease times on port mappings
remote_host_must_be_wildcard | 726 | RemoteHost must be a wildcard and cannot be a specific IP addres or DNS name
external_port_must_be_wildcard | 727 | ExternalPort must be a wildcard and cannot be a specific port