| libtorrent

Author: | Arvid Norberg, arvid@libtorrent.org
Version: | 1.2.16

home

# Error Codes

Table of contents

- Error Codes
  - storage_error
  - gzip_category()
  - i2p_category()
  - bdecode_category()
  - upnp_category()
  - libtorrent_category()
  - http_category()
  - socks_category()
  - pcp_category()
  - enum error_code_enum
  - enum i2p_error_code
  - enum error_code_enum
  - enum error_code_enum
  - enum error_code_enum
  - enum http_errors
  - enum socks_error_code
  - enum pcp_errors

[report issue]

## storage_error

Declared in "libtorrent/error_code.hpp"

used by storage to return errors also includes which underlying file the error happened on

    struct storage_error
    {
       explicit operator bool () const;
       file_index_t file () const;
       void file (file_index_t f);

       error_code ec;
       operation_t operation;
    };

[report issue]

### bool()

    explicit operator bool () const;

explicitly converts to true if this object represents an error, and false if it does not.

[report issue]

### file()

    file_index_t file () const;
    void file (file_index_t f);

set and query the index (in the torrent) of the file this error occurred on. This may also have special values defined in torrent_status.

[report issue]

ec
  the error that occurred

[report issue]

operation
  A code from operation_t enum, indicating what kind of operation failed.

[report issue]

## gzip_category()

Declared in "libtorrent/gzip.hpp"

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

get the `error_category` for zip errors

[report issue]

## i2p_category()

Declared in "libtorrent/i2p_stream.hpp"

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

returns the error category for I2P errors

[report issue]

## bdecode_category()

Declared in "libtorrent/bdecode.hpp"

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

[report issue]

## upnp_category()

Declared in "libtorrent/upnp.hpp"

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

the boost.system error category for UPnP errors

[report issue]

## libtorrent_category()

Declared in "libtorrent/error_code.hpp"

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

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

[report issue]

## http_category()

Declared in "libtorrent/error_code.hpp"

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

returns the error_category for HTTP errors

[report issue]

## socks_category()

Declared in "libtorrent/socks5_stream.hpp"

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

returns the error_category for SOCKS5 errors

[report issue]

## pcp_category()

Declared in "libtorrent/natpmp.hpp"

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

[report issue]

## enum error_code_enum

Declared in "libtorrent/gzip.hpp"

name | value | description
--- | --- | ---
no_error | 0 | Not an error
invalid_gzip_header | 1 | the supplied gzip buffer has invalid header
inflated_data_too_large | 2 | the gzip buffer would inflate to more bytes than the specified maximum size, and was rejected.
data_did_not_terminate | 3 | available inflate data did not terminate
space_exhausted | 4 | output space exhausted before completing inflate
invalid_block_type | 5 | invalid block type (type == 3)
invalid_stored_block_length | 6 | stored block length did not match one's complement
too_many_length_or_distance_codes | 7 | dynamic block code description: too many length or distance codes
code_lengths_codes_incomplete | 8 | dynamic block code description: code lengths codes incomplete
repeat_lengths_with_no_first_length | 9 | dynamic block code description: repeat lengths with no first length
repeat_more_than_specified_lengths | 10 | dynamic block code description: repeat more than specified lengths
invalid_literal_length_code_lengths | 11 | dynamic block code description: invalid literal/length code lengths
invalid_distance_code_lengths | 12 | dynamic block code description: invalid distance code lengths
invalid_literal_code_in_block | 13 | invalid literal/length or distance code in fixed or dynamic block
distance_too_far_back_in_block | 14 | distance is too far back in fixed or dynamic block
unknown_gzip_error | 15 | an unknown error occurred during gzip inflation
error_code_max | 16 | the number of error codes

[report issue]

## 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 |

[report issue]

## enum error_code_enum

Declared in "libtorrent/bdecode.hpp"

name | value | description
--- | --- | ---
no_error | 0 | Not an error
expected_digit | 1 | expected digit 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

[report issue]

## 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 a wildcard, 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 address or DNS name
external_port_must_be_wildcard | 727 | ExternalPort must be a wildcard and cannot be a specific port

[report issue]

## 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 unexpectedly 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 corrupt 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 extension 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 plain text, 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 because 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 don't 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
banned_by_port_filter | 114 | peer was banned because its listen port is within a banned port range, as specified by the port_filter.
invalid_session_handle | 115 | The session_handle is not referring to a valid session_impl
invalid_listen_socket | 116 | the listen socket associated with this request was closed
ssrf_mitigation | 117 | blocked by SSRF mitigation
blocked_by_idna | 118 | blocked because IDNA host names are banned
deprecated_120 | 120 |
deprecated_121 | 121 |
deprecated_122 | 122 |
deprecated_123 | 123 |
deprecated_124 | 124 |
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. DEPRECATED
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. DEPRECATED
resume_data_not_modified | 143 | this error is returned when asking to save resume data and specifying the flag to only save when there's anything new to save (torrent_handle::only_if_modified) and there wasn't anything changed.
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
no_i2p_endpoint | 161 | i2p acceptor is not available yet, can't announce without endpoint
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
announce_skipped | 180 | skipped announce (because it's assumed to be unreachable over the given source network interface)
no_entropy | 200 | random number generation failed
error_code_max | 201 | the number of error codes

[report issue]

## 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 |

[report issue]

## 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 |

[report issue]

## enum pcp_errors

Declared in "libtorrent/natpmp.hpp"

name | value | description
--- | --- | ---
pcp_success | 0 |
pcp_unsupp_version | 1 |
pcp_not_authorized | 2 |
pcp_malformed_request | 3 |
pcp_unsupp_opcode | 4 |
pcp_unsupp_option | 5 |
pcp_malformed_option | 6 |
pcp_network_failure | 7 |
pcp_no_resources | 8 |
pcp_unsupp_protocol | 9 |
pcp_user_ex_quota | 10 |
pcp_cannot_provide_external | 11 |
pcp_address_mismatch | 12 |
pcp_excessive_remote_peers | 13 |