Fix it

aria2 troubleshooting

Paste the error aria2 printed, or browse by topic. Most messages below were reproduced on purpose with aria2 1.37.0, so you see exactly what aria2 says, what it means and how to fix it.

Last updated: Tested with aria2 1.37.0

Install

aria2c: command not found

Error message
aria2c: command not found
'aria2c' is not recognized as an internal or external command

aria2 is not installed, or its folder is not on your PATH.

Fix

Install it (sudo apt install aria2, brew install aria2, winget install -e --id aria2.aria2), then open a new terminal. On Windows, if you unzipped aria2 yourself, add that folder to Path or run it with its full path. Check with aria2c --version.

error while loading shared libraries

Error message
error while loading shared libraries: libcares.so.2: cannot open shared object file: No such file or directory

A self-built or copied aria2 binary needs a library your system lacks.

Fix

Install aria2 from your distribution's package manager instead, which brings the right libraries. If you must keep that binary, install the named library (for example libc-ares2 on Debian/Ubuntu).

Windows: a .dll was not found

Error message
The code execution cannot proceed because libssh2.dll was not found.

An aria2c.exe from an unofficial build that needs extra DLLs.

Fix

Use the official Windows zip from the aria2 releases page or winget install -e --id aria2.aria2; the official build needs no extra DLLs.

macOS: "cannot be opened because the developer cannot be verified"

Error message
"aria2c" cannot be opened because the developer cannot be verified.

macOS blocks downloaded binaries that are not notarized.

Fix

Install with Homebrew (brew install aria2), which avoids the warning. Otherwise allow it once in System Settings → Privacy & Security.

Config & startup

Unknown option

Error message · ✓ Reproduced with aria2 1.37.0
[WARN] Unknown option: ca-bundle=/etc/ssl/cert.pem

A key in aria2.conf or on the command line is misspelled or does not exist. aria2 ignores it and starts anyway, so the setting silently does nothing.

Fix

Look the name up in the options reference. A common one: ca-bundle does not exist; the option is ca-certificate.

Parse error in aria2.conf

exit 28
Error message · ✓ Reproduced with aria2 1.37.0
Parse error in aria2.conf
errorCode=1 Bad number 16 # sixteen

aria2 cannot read a value in the config file and refuses to start (exit code 28).

Fix

Read the next line of the message: it names the option. Comments must be on their own line (split=16 # comment fails), and quotes are not removed. The config generator writes a valid file.

must be between 1 and 16

exit 28
Error message · ✓ Reproduced with aria2 1.37.0
errorCode=1 max-connection-per-server must be between 1 and 16.

A value is outside the allowed range; aria2 does not start.

Fix

max-connection-per-server allows 1 to 16. For other options, aria2c --help=OPTION shows the allowed values.

Failed to open the file …aria2.session

exit 1
Error message · ✓ Reproduced with aria2 1.37.0
errorCode=1 Failed to open the file /root/.aria2/aria2.session, cause: File not found or it is a directory

input-file points to a session file that does not exist yet, so aria2 stops.

Fix

Create it once: mkdir -p ~/.aria2 && touch ~/.aria2/aria2.session (Windows: New-Item -ItemType File -Force "$env:USERPROFILE\.aria2\aria2.session").

No files to download.

exit 0
Error message · ✓ Reproduced with aria2 1.37.0
No files to download.

Your config sets input-file, so aria2 reads downloads from the session file and ignores URLs on the command line.

Fix

For a one-off download clear it for that run: aria2c --input-file= URL. For an RPC server this behaviour is correct.

Downloads land in a folder named "~"

aria2 does not expand ~ in aria2.conf; it creates a folder literally called "~".

Fix

Write ${HOME} instead, for example dir=${HOME}/Downloads. In the terminal ~ works as usual.

Downloads use a proxy you never set

aria2 reads the http_proxy, https_proxy and all_proxy environment variables, like many command-line tools.

Fix

Check with env | grep -i proxy. Exclude hosts with --no-proxy=HOSTS, or start aria2 without those variables.

HTTP & network

status=403 (Forbidden)

exit 22
Error message · ✓ Reproduced with aria2 1.37.0
errorCode=22 The response status is not successful. status=403

The server refused the request. Usually the link needs your login cookies, a Referer, or has expired; some servers also refuse many connections.

Fix

Send the download from the browser with an extension that forwards cookies (see the browser guide), or pass them with --load-cookies or --header. Get a fresh link if it expired, and try -x 4.

Resource not found (404)

exit 3
Error message · ✓ Reproduced with aria2 1.37.0
errorCode=3 Resource not found

Nothing exists at that URL (exit code 3).

Fix

Check the link for typos and whether the file has moved. Links copied from download pages are often temporary; copy a fresh one.

status=429 (Too Many Requests)

exit 22
Error message · ✓ Reproduced with aria2 1.37.0
errorCode=22 The response status is not successful. status=429

The server limits how many requests you make. aria2 reports it with exit code 22.

Fix

Use fewer connections (-x 4), fewer simultaneous downloads (-j 1), and add --retry-wait=30.

status=503 (Service Unavailable)

exit 29
Error message · ✓ Reproduced with aria2 1.37.0
errorCode=29 The response status is not successful. status=503

The server is overloaded or in maintenance (exit code 29). It can also mean it allows fewer connections than you opened.

Fix

Retry later with --max-tries=0 --retry-wait=30, and lower -x.

Authorization failed (401)

exit 24
Error message · ✓ Reproduced with aria2 1.37.0
errorCode=24 Authorization failed.

The server wants a user name and password (exit code 24).

Fix

Pass them with --http-user=USER --http-passwd=PASS (FTP: --ftp-user, --ftp-passwd). We confirmed this fixes the error.

Too many redirects

exit 23
Error message · ✓ Reproduced with aria2 1.37.0
errorCode=23 Too many redirects: count=20

The server sent aria2 around in a loop; aria2 gives up after 20 redirects (exit code 23).

Fix

This usually means the site wants a login cookie and keeps redirecting to its login page. Forward cookies, or open the link in a browser to find the final URL.

Timeout.

exit 2
Error message · ✓ Reproduced with aria2 1.37.0
errorCode=2 Timeout.

The server accepted the connection but did not answer in time (exit code 2).

Fix

Retry, raise --timeout and --connect-timeout for slow servers, and set --max-tries=0 to keep trying.

Failed to establish connection, cause: Connection refused

exit 1
Error message · ✓ Reproduced with aria2 1.37.0
errorCode=1 Failed to establish connection, cause: Connection refused

Nothing is listening at that host and port, or a firewall rejects it. With a proxy set, the proxy itself may be down.

Fix

Check the address and port. If you use --all-proxy or a proxy environment variable, check the proxy first.

Name resolution failed

exit 19
Error message · ✓ Reproduced with aria2 1.37.0
errorCode=19 Name resolution for no-such-host.invalid failed:Domain name not found

aria2 could not look up the host name (exit code 19).

Fix

Check the spelling and your DNS. If IPv6 is broken on your network, --disable-ipv6=true often helps; --async-dns=false makes aria2 use the system resolver.

Invalid range header

exit 8
Error message · ✓ Reproduced with aria2 1.37.0
errorCode=8 Invalid range header. Request: 1048576-2097151/2097152, Response: 0-2097151/2097152

The server ignores range requests and always sends the whole file. Multi-connection downloads fall back to one connection, and resuming is impossible (exit code 8 when a resume was required).

Fix

Nothing to fix on your side: download it in one go with -x 1. In our test the download still completed with one connection.

aria2 saved a small HTML page instead of the file

The server answered with a web page (a login page or an expired-link notice) and a success status, so aria2 saved it.

Fix

Open the saved file in a text editor to read it. Then send the download from the browser with cookies, or get a fresh link.

TLS / SSL

SSL/TLS handshake failure: not signed by known authorities

exit 1
Error message · ✓ Reproduced with aria2 1.37.0
errorCode=1 SSL/TLS handshake failure:  `not signed by known authorities or invalid' `issuer is not known'

aria2 cannot verify the server's certificate: it is self-signed, signed by a private CA, or your CA bundle is missing.

Fix

Point aria2 at the right CA file: --ca-certificate=/path/ca.pem. Install your system's CA certificates package. Only for a server you trust, --check-certificate=false skips the check. We tested both.

Files & disk

File exists, but a control file (*.aria2) does not exist

exit 13
Error message · ✓ Reproduced with aria2 1.37.0
errorCode=13 File big.bin exists, but a control file(*.aria2) does not exist. Download was canceled in order to prevent your file from being truncated to 0.

With --allow-overwrite=false and --auto-file-renaming=false, aria2 refuses to touch an existing file it has no progress for (exit code 13).

Fix

Delete or move the old file, or add --allow-overwrite=true. Do not "resume" it with -c after a multi-connection download; see the .aria2 file tests.

File already exists. Renamed to …

Error message · ✓ Reproduced with aria2 1.37.0
File already exists. Renamed to /downloads/big.1.bin.

By default aria2 keeps the existing file and saves the new one as name.1.ext.

Fix

If you meant to resume, the .aria2 control file was missing. See the .aria2 file guide for what to do.

Failed to make the directory

exit 18
Error message · ✓ Reproduced with aria2 1.37.0
errorCode=18 Failed to make the directory /etc/passwd, cause: File exists

The download folder cannot be created: a file has that name, the path is read-only, or you lack permission (exit code 18).

Fix

Check dir. Make sure the folder's parent exists and is writable by the user running aria2 (in Docker, by the container user).

Failed to open the file … No such file or directory / Permission denied

exit 16
Error message · ✓ Reproduced with aria2 1.37.0
errorCode=16 Failed to open the file /proc/big.bin, cause: No such file or directory

aria2 cannot create the output file (exit code 16).

Fix

Check that the folder exists and is writable, and that the file name is valid on that file system (Windows forbids : * ? " < > |).

Detected a change in piece length

exit 10
Error message · ✓ Reproduced with aria2 1.37.0
errorCode=10 WARNING: Detected a change in piece length. You can proceed with --allow-piece-length-change=true, but you may lose some download progress.

You resumed with a different --piece-length than the .aria2 file was written with (exit code 10).

Fix

Resume with the original setting, or add --allow-piece-length-change=true and accept losing some progress.

Checksum error detected

exit 32
Error message · ✓ Reproduced with aria2 1.37.0
Checksum error detected. file=ck.bin

The finished file does not match the --checksum you gave (exit code 32).

Fix

Check that the hash belongs to this exact file. To repair, run again with -V -c and the same --checksum; aria2 re-downloads what is wrong.

Not enough disk space

exit 9

The disk filled up (exit code 9). With file-allocation=prealloc or falloc aria2 needs the full size before it starts.

Fix

Free space or choose another dir. file-allocation=none lets a download start without reserving space, but it can still run out later.

RPC & WebUI

Failed to bind a socket … Address already in use

exit 1
Error message · ✓ Reproduced with aria2 1.37.0
IPv4 RPC: failed to bind TCP port 6800
errorCode=1 Failed to bind a socket, cause: Address already in use

Another aria2 (or another program) already uses port 6800.

Fix

Stop the other instance, or start this one with --rpc-listen-port=6801 and connect to that port.

IPv6 RPC: failed to bind TCP port 6800

Error message · ✓ Reproduced with aria2 1.37.0
IPv6 RPC: failed to bind TCP port 6800

Harmless when IPv6 is off, as in most Docker containers. The line before it says the IPv4 listener works.

Fix

Nothing to fix. Only if a line also says IPv4 RPC: failed to bind is the port really taken.

RPC answers "Unauthorized"

Error message · ✓ Reproduced with aria2 1.37.0
{"code":1,"message":"Unauthorized"}

The secret sent by the client does not match --rpc-secret. The connection itself works.

Fix

Enter exactly the value of rpc-secret in the client. In raw calls it is the first parameter: "token:SECRET".

RPC answers "Parse error."

Error message · ✓ Reproduced with aria2 1.37.0
{"code":-32700,"message":"Parse error."}

The request body is not valid JSON, often because of shell quoting.

Fix

Wrap the JSON in single quotes in the shell, and check commas and brackets. On Windows PowerShell, use Invoke-RestMethod with a body instead of curl quoting.

No such method

Error message · ✓ Reproduced with aria2 1.37.0
{"code":1,"message":"No such method: aria2.nope"}

The method name is misspelled or lacks the aria2. prefix.

Fix

Method names look like aria2.addUri and aria2.tellActive. system.listMethods lists them all.

BitTorrent & links

Unrecognized URI or unsupported protocol

exit 1
Error message · ✓ Reproduced with aria2 1.37.0
errorCode=1 Unrecognized URI or unsupported protocol: magnet:?xt=urn:btih:zzzz

aria2 could not use what you gave it: a typo, a malformed magnet link, or a file path that does not exist.

Fix

A magnet link needs a 40-character hex or 32-character base32 hash after xt=urn:btih:. Quote links that contain & in the shell. For files, check the path.

Bencode decoding failed

exit 25
Error message · ✓ Reproduced with aria2 1.37.0
errorCode=25 Bencode decoding failed

The .torrent file is damaged or is not a torrent at all, often an HTML page saved under that name (exit code 25).

Fix

Download the .torrent again, or use the magnet link instead.

Could not parse Metalink XML document

exit 20
Error message · ✓ Reproduced with aria2 1.37.0
errorCode=20 Could not parse Metalink XML document.

The .metalink or .meta4 file is broken (exit code 20).

Fix

Download it again; open it in a text editor to see whether it is really XML.

BitTorrent: 0 peers, 0 B/s

aria2 cannot find or reach anyone sharing the torrent.

Fix

Add fresh trackers from the tracker list, keep DHT on, set a fixed listen-port and dht-listen-port and forward them for TCP and UDP. The speed guide has a ready block.

Magnet link stuck before the download starts

aria2 must first get the torrent's metadata from peers, and has not found any yet.

Fix

Same fixes as for 0 peers: trackers and DHT. Add --bt-save-metadata=true so the metadata is kept as a .torrent once it arrives.

aria2 keeps seeding after the download

aria2 seeds until the share ratio reaches seed-ratio (1.0 by default); with ratio 0.0 it seeds forever.

Fix

Set seed-time=0 to stop right after the download, or a ratio such as seed-ratio=1.0.

aria2 exit codes

aria2 returns the code of the last error it met (from the manual). Errors in downloads that finished are not reported.

CodeMeaningSee
0 All downloads succeeded
1 Unknown error (also used for connection, TLS and RPC-port errors)
2 Timeout Timeout.
3 Resource not found Resource not found (404)
4 "Resource not found" reached --max-file-not-found
5 Too slow: --lowest-speed-limit
6 Network problem
7 Unfinished downloads when aria2 was stopped (Ctrl+C)
8 The server does not support resume, but resume was required Invalid range header
9 Not enough disk space Not enough disk space
10 Piece length differs from the .aria2 file Detected a change in piece length
11 aria2 was already downloading the same file
12 aria2 was already downloading the same torrent
13 The file already exists File exists, but a control file (*.aria2) does not exist
14 Renaming the file failed
15 Could not open an existing file
16 Could not create or truncate the file Failed to open the file … No such file or directory / Permission denied
17 File I/O error
18 Could not create the directory Failed to make the directory
19 Name resolution failed Name resolution failed
20 Could not parse the Metalink document Could not parse Metalink XML document
21 FTP command failed
22 Bad or unexpected HTTP response (also 403, 429) status=403 (Forbidden)
23 Too many redirects Too many redirects
24 HTTP authorization failed Authorization failed (401)
25 Could not parse a bencoded (.torrent) file Bencode decoding failed
26 .torrent file corrupted or incomplete
27 Bad magnet URI
28 Bad option or option value Parse error in aria2.conf
29 Server temporarily overloaded or in maintenance (503) status=503 (Service Unavailable)
30 Could not parse the JSON-RPC request
31 Reserved, not used
32 Checksum validation failed Checksum error detected

Related resources