{"record":{"id":"433f00e9acd74314","repo":"ipfs/kubo","slug":"operation-not-supported","errorCode":null,"errorMessage":"operation not supported","messagePattern":"operation not supported","errorType":"exception","errorClass":"ErrNotSupported","httpStatus":null,"severity":"warning","filePath":"core/coreiface/errors.go","lineNumber":9,"sourceCode":"package iface\n\nimport \"errors\"\n\nvar (\n\tErrIsDir        = errors.New(\"this dag node is a directory\")\n\tErrNotFile      = errors.New(\"this dag node is not a regular file\")\n\tErrOffline      = errors.New(\"this action must be run in online mode, try running 'ipfs daemon' first\")\n\tErrNotSupported = errors.New(\"operation not supported\")\n)\n","sourceCodeStart":1,"sourceCodeEnd":11,"githubUrl":"https://github.com/ipfs/kubo/blob/329838acdfafae224582930457efe80aa217afc0/core/coreiface/errors.go#L1-L11","documentation":"`iface.ErrNotSupported` is the generic sentinel for operations the current CoreAPI implementation cannot perform. In kubo it is returned when a command encounters a node kind it cannot handle (e.g. cat on a non-file, non-directory node) and when optional capability methods are stubs — for example the HTTP content router's ProvideBitswap always returns routing.ErrNotSupported because the public HTTP Routing API does not implement Bitswap write-provide.","triggerScenarios":"`ipfs cat` on a node that is neither files.File nor files.Directory (core/commands/cat.go default case); calling `ProvideBitswap` on the HTTP routing client (`core/corehttp/routing.go` contentRouter), which is a hardcoded unsupported stub; calling optional CoreAPI methods (GetIPNS/PutIPNS variants) against implementations that do not support them.","commonSituations":"Tooling calling the deprecated/limited HTTP routing API's provide path and getting ErrNotSupported back; CLI users hitting `ipfs cat` on exotic DAG node types (raw leaves handled elsewhere, but unsupported types fall into the default branch); embedding CoreAPI and invoking capability methods absent from the chosen implementation.","solutions":["For the routing API case, use a provide mechanism the node actually supports (Bitswap provide via the local node, or a delegated routing provider that implements the operation) instead of the HTTP content router's ProvideBitswap.","For `cat` errors, inspect the node type (`ipfs dag get <cid>`) and use the right reader (dag export/ls) for that node kind.","In code, match with `errors.Is(err, iface.ErrNotSupported)` and fall back to an alternative implementation or surface a 'not supported by this node' message."],"exampleFix":"// before\nd, err := router.ProvideBitswap(ctx, req) // always ErrNotSupported on HTTP router\n// after\nif err != nil && errors.Is(err, routing.ErrNotSupported) {\n    d, err = fallbackProvider.Provide(ctx, c, true)\n}","handlingStrategy":"fallback","validationCode":"// Check capability before calling:\n// - for routing: confirm the endpoint implements provide (kubo's HTTP contentRouter does not)\n// - for cat: confirm node kind is files.File or files.Directory before reading","typeGuard":"func isSupported(node files.Node) bool {\n    switch node.(type) {\n    case files.File, files.Directory:\n        return true\n    default:\n        return false\n    }\n}","tryCatchPattern":"d, err := router.ProvideBitswap(ctx, req)\nif err != nil && errors.Is(err, routing.ErrNotSupported) {\n    d, err = localNode.Provider.Provide(ctx, c, true) // alternate provide path\n}","preventionTips":["Do not call ProvideBitswap on the HTTP routing client; use local or delegated providers","Handle ErrNotSupported explicitly so stub methods fail gracefully","Check node types before choosing reader APIs (file vs dag readers)","Consult docs for which CoreAPI methods are optional per implementation"],"tags":["coreapi","sentinel-error","routing","unsupported-operation"],"backgroundTag":"operation-not-supported","analyzedSha":"329838acdfafae224582930457efe80aa217afc0","analyzedAt":"2026-09-03T18:30:52.135Z","contentChangedAt":"2026-09-03T18:30:52.135Z","schemaVersion":2},"datasetVersion":"2026-09-11T00:17:11.886Z"}