Skip to content

Kubo doesn't throw a proper error if I add content to the network with offline/inaccessible http routers #10952

@Rinse12

Description

@Rinse12

Checklist

Installation method

dist.ipfs.tech or ipfs-update

Version

Kubo version: 0.37.0
Repo version: 17
System version: amd64/linux
Golang version: go1.25.0

Config

{
  "API": {
    "HTTPHeaders": {}
  },
  "Addresses": {
    "API": "/ip4/127.0.0.1/tcp/54322",
    "Announce": [],
    "AppendAnnounce": [],
    "Gateway": "/ip4/127.0.0.1/tcp/54323",
    "NoAnnounce": [],
    "Swarm": [
      "/ip4/0.0.0.0/tcp/54321",
      "/ip6/::/tcp/54321",
      "/ip4/0.0.0.0/udp/54321/webrtc-direct",
      "/ip4/0.0.0.0/udp/54321/quic-v1",
      "/ip4/0.0.0.0/udp/54321/quic-v1/webtransport",
      "/ip6/::/udp/54321/webrtc-direct",
      "/ip6/::/udp/54321/quic-v1",
      "/ip6/::/udp/54321/quic-v1/webtransport"
    ]
  },
  "AutoConf": {},
  "AutoNAT": {},
  "AutoTLS": {},
  "Bitswap": {},
  "Bootstrap": ["auto"],
  "DNS": {
    "Resolvers": {
      ".": "auto"
    }
  },
  "Datastore": {
    "BlockKeyCacheSize": null,
    "BloomFilterSize": 0,
    "GCPeriod": "1h",
    "HashOnRead": false,
    "Spec": {
      "mounts": [
        {
          "mountpoint": "/blocks",
          "path": "blocks",
          "prefix": "flatfs.datastore",
          "shardFunc": "/repo/flatfs/shard/v1/next-to-last/2",
          "sync": false,
          "type": "flatfs"
        },
        {
          "compression": "none",
          "mountpoint": "/",
          "path": "datastore",
          "prefix": "leveldb.datastore",
          "type": "levelds"
        }
      ],
      "type": "mount"
    },
    "StorageGCWatermark": 90,
    "StorageMax": "10GB"
  },
  "Discovery": {
    "MDNS": {
      "Enabled": false
    }
  },
  "Experimental": {
    "FilestoreEnabled": false,
    "Libp2pStreamMounting": false,
    "OptimisticProvide": false,
    "OptimisticProvideJobsPoolSize": 0,
    "P2pHttpProxy": false,
    "UrlstoreEnabled": false
  },
  "Gateway": {
    "DeserializedResponses": null,
    "DisableHTMLErrors": null,
    "ExposeRoutingAPI": null,
    "HTTPHeaders": {},
    "NoDNSLink": false,
    "NoFetch": false,
    "PublicGateways": null,
    "RootRedirect": ""
  },
  "HTTPRetrieval": {},
  "Identity": {
    "PeerID": "12D3KooWCwKzba6nE1KW6YrDfjWGGAYspZAP6unutUULtpYXmMXC"
  },
  "Import": {
    "BatchMaxNodes": null,
    "BatchMaxSize": null,
    "CidVersion": null,
    "HashFunction": null,
    "UnixFSChunker": null,
    "UnixFSDirectoryMaxLinks": null,
    "UnixFSFileMaxLinks": null,
    "UnixFSHAMTDirectoryMaxFanout": null,
    "UnixFSHAMTDirectorySizeThreshold": null,
    "UnixFSRawLeaves": null
  },
  "Internal": {},
  "Ipns": {
    "DelegatedPublishers": ["auto"],
    "RecordLifetime": "",
    "RepublishPeriod": "",
    "ResolveCacheSize": 128
  },
  "Migration": {},
  "Mounts": {
    "FuseAllowOther": false,
    "IPFS": "/ipfs",
    "IPNS": "/ipns",
    "MFS": "/mfs"
  },
  "Peering": {
    "Peers": null
  },
  "Pinning": {
    "RemoteServices": {}
  },
  "Plugins": {
    "Plugins": null
  },
  "Provider": {},
  "Pubsub": {
    "DisableSigning": false,
    "Router": ""
  },
  "Reprovider": {},
  "Routing": {
    "Methods": {
      "find-peers": {
        "RouterName": "HttpRouterNotSupported"
      },
      "find-providers": {
        "RouterName": "HttpRoutersParallel"
      },
      "get-ipns": {
        "RouterName": "HttpRouterNotSupported"
      },
      "provide": {
        "RouterName": "HttpRoutersParallel"
      },
      "put-ipns": {
        "RouterName": "HttpRouterNotSupported"
      }
    },
    "Routers": {
      "HttpRouter1": {
        "Parameters": {
          "Endpoint": "http://127.0.0.1:19999"
        },
        "Type": "http"
      },
      "HttpRouter2": {
        "Parameters": {
          "Endpoint": "http://127.0.0.1:19998"
        },
        "Type": "http"
      },
      "HttpRouterNotSupported": {
        "Parameters": {
          "Endpoint": "http://kubohttprouternotsupported"
        },
        "Type": "http"
      },
      "HttpRoutersParallel": {
        "Parameters": {
          "Routers": [
            {
              "IgnoreErrors": false,
              "RouterName": "HttpRouter1",
              "Timeout": "5s"
            },
            {
              "IgnoreErrors": false,
              "RouterName": "HttpRouter2",
              "Timeout": "5s"
            }
          ]
        },
        "Type": "parallel"
      }
    },
    "Type": "custom"
  },
  "Swarm": {
    "AddrFilters": null,
    "ConnMgr": {},
    "DisableBandwidthMetrics": false,
    "DisableNatPortMap": false,
    "RelayClient": {},
    "RelayService": {},
    "ResourceMgr": {},
    "Transports": {
      "Multiplexers": {},
      "Network": {},
      "Security": {}
    }
  },
  "Version": {}
}

Description

When using kubo 0.37.0 with a custom routing configuration containing offline HTTP routers, the kubo add operation succeeds instead of failing as expected.

What I was doing:

Adding content to IPFS using kubo add with a configuration that has parallel HTTP routers pointing to offline endpoints (127.0.0.1:19999 and 127.0.0.1:19998). The routers are configured with IgnoreErrors: false and 5-second timeouts.

Expected behavior:

The add operation should fail with an error when all HTTP routers are unreachable, since IgnoreErrors is set to false.

Actual behavior:

The add operation completes successfully and returns a valid IPFS hash despite all routers being offline.

Steps to reproduce:

  1. Clone https://github.com/Rinse12/kubo_add_not_throwing_if_providers_not_online
  2. Run npm i
  3. Run node test-offline-routers.js

The test script automatically configures kubo 0.37.0 with offline HTTP routers and demonstrates the issue. It uses custom routing with parallel routers where both endpoints are intentionally unreachable to simulate network failures.

Configuration details:

  • Routing type: custom with parallel HTTP routers
  • Router endpoints: offline (127.0.0.1:19999, 127.0.0.1:19998)
  • IgnoreErrors: false (failures should not be ignored)
  • Timeout: 5s per router

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugA bug in existing code (including security flaws)need/triageNeeds initial labeling and prioritization

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions