# "use of closed network connection" when \`ipfs add -r\`

**URL:** <https://discuss.ipfs.tech/t/use-of-closed-network-connection-when-ipfs-add-r/20018>\
**Category:** Help\
**Tags:** go-ipfs, kubo\
**Created:** [February 8, 2026, 12:10pm UTC](https://discuss.ipfs.tech/t/use-of-closed-network-connection-when-ipfs-add-r/20018 "2026-02-08T12:10:53Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Natureshadow](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/natureshadow/32/9715_2.png) [@Natureshadow](https://discuss.ipfs.tech/u/Natureshadow)\
**Post date:** [February 8, 2026, 12:10pm UTC](https://discuss.ipfs.tech/t/use-of-closed-network-connection-when-ipfs-add-r/20018/1 "2026-02-08T12:10:53Z")

</div>

I am trying to recursively add a directory using `ipfs add -r`.

It calculates and displays 8 CIDs, then it stops with: `Error: read tcp 127.0.0.1:57868->127.0.0.1:5001: use of closed network connection`

Adding the individual files works flawlessly, though.

What could be the cause?

---

<div class="post-metadata">

**Author:** ![lidel](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/lidel/32/9853_2.png) [@lidel](https://discuss.ipfs.tech/u/lidel)\
**Post date:** [February 14, 2026, 3:39pm UTC](https://discuss.ipfs.tech/t/use-of-closed-network-connection-when-ipfs-add-r/20018/2 "2026-02-14T15:39:18Z")

</div>

Hard to say. The`ipfs add` CLI talks to Kubo (`ipfs daemon`) over HTTP RPC at `127.0.0.1:5001/api/v0`, either your daemon got killed, or something killed that connection.

`ipfs` CLI will prefer HTTP RPC if `~/.ipfs/api` is present (or `%IPFS_PATH/api`)

If you can’t figure out what kills HTTP connection to local RPC, you could try workaround: stop daemon and run `ipfs add` in offline mode, which operates on repository directly, and once finished, start demon again.

If you have more information and it looks like a bug, report one at [GitHub · Where software is built](https://github.com/ipfs/kubo/issues)

---

<div class="post-metadata">

**Author:** ![pyc](https://avatars.discourse-cdn.com/v4/letter/p/8baadc/32.png) [@pyc](https://discuss.ipfs.tech/u/pyc)\
**Post date:** [April 1, 2026, 4:45pm UTC](https://discuss.ipfs.tech/t/use-of-closed-network-connection-when-ipfs-add-r/20018/3 "2026-04-01T16:45:14Z")

</div>

Try [https://guibo.vizio.biz](https://guibo.vizio.biz), it’s capable of uploading many files/dirs to Kubo at once.

---

<div class="post-metadata">

**Author:** ![Freya97](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/freya97/32/9817_2.png) [@Freya97](https://discuss.ipfs.tech/u/Freya97)\
**Post date:** [July 21, 2026, 3:09pm UTC](https://discuss.ipfs.tech/t/use-of-closed-network-connection-when-ipfs-add-r/20018/4 "2026-07-21T15:09:50Z")

</div>

Run `ipfs --offline add -r <dir>` to bypass the API and avoid connection timeouts.  
If offline works, the daemon’s HTTP timeout or resource limits are likely closing the socket mid-request.
