{"record":{"id":"25883015c695a681","repo":"ipfs/kubo","slug":"name-resolve-depth-other-than-1-or-d-not-support","errorCode":null,"errorMessage":"Name.Resolve: depth other than 1 or %d not supported","messagePattern":"Name\\.Resolve: depth other than 1 or (.+?) not supported","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"client/rpc/name.go","lineNumber":54,"sourceCode":"\t\treq.Option(\"ttl\", options.TTL)\n\t}\n\n\tvar out ipnsEntry\n\tif err := req.Exec(ctx, &out); err != nil {\n\t\treturn ipns.Name{}, err\n\t}\n\treturn ipns.NameFromString(out.Name)\n}\n\nfunc (api *NameAPI) Search(ctx context.Context, name string, opts ...caopts.NameResolveOption) (<-chan iface.IpnsResult, error) {\n\toptions, err := caopts.NameResolveOptions(opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tropts := namesys.ProcessResolveOptions(options.ResolveOpts)\n\tif ropts.Depth != namesys.DefaultDepthLimit && ropts.Depth != 1 {\n\t\treturn nil, fmt.Errorf(\"Name.Resolve: depth other than 1 or %d not supported\", namesys.DefaultDepthLimit)\n\t}\n\n\treq := api.core().Request(\"name/resolve\", name).\n\t\tOption(\"nocache\", !options.Cache).\n\t\tOption(\"recursive\", ropts.Depth != 1).\n\t\tOption(\"dht-record-count\", ropts.DhtRecordCount).\n\t\tOption(\"dht-timeout\", ropts.DhtTimeout).\n\t\tOption(\"stream\", true)\n\tresp, err := req.Send(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif resp.Error != nil {\n\t\treturn nil, resp.Error\n\t}\n\n\tres := make(chan iface.IpnsResult)\n","sourceCodeStart":36,"sourceCodeEnd":72,"githubUrl":"https://github.com/ipfs/kubo/blob/329838acdfafae224582930457efe80aa217afc0/client/rpc/name.go#L36-L72","documentation":"The RPC client's name Search path only supports resolving at depth 1 (non-recursive) or DefaultDepthLimit (-1, unlimited); any other depth is rejected because name/resolve over HTTP only exposes the recursive toggle, not intermediate depths.","triggerScenarios":"Calling api.Name().Search(ctx, name, options.Name.ResolveOption(...)...) — via Resolve with depth>1 — after constructing options.ResolveOpts{Depth: n} where n is neither 1 nor -1 (e.g. Depth: 2 or 3 for 'resolve two hops').","commonSituations":"Developers translating the local namesys API (which supports arbitrary depths) to the HTTP client and picking a bounded depth like 2; porting code that used ipfs name resolve -d 2 locally.","solutions":["Use Depth: 1 for a single resolution step or namesys.DefaultDepthLimit (-1) for full recursion; drop the Depth option to get the default.","If you genuinely need intermediate depth, resolve fully (depth -1) and walk the returned path segments yourself.","Run a local daemon lookup with `ipfs name resolve --dht-record-count ... -d N` via exec if intermediate depth is a hard requirement."],"exampleFix":"// before\np, err := api.Name().Resolve(ctx, name, options.Name.AllowOffline(false))\n// opts had ResolveOpts{Depth: 2}\n// after\nropts := options.ResolveOpts{Depth: namesys.DefaultDepthLimit} // or 1\np, err := api.Name().Resolve(ctx, name, options.Name.AllowOffline(false))","handlingStrategy":"validation","validationCode":"d := optsDepth // your configured depth\nif d != 1 && d != namesys.DefaultDepthLimit {\n    d = namesys.DefaultDepthLimit // clamp to a supported value before calling\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Only use Depth 1 or namesys.DefaultDepthLimit with the HTTP client","Centralize ResolveOpts construction so arbitrary depths never reach Resolve","Resolve recursively and truncate paths locally if bounded depth is needed"],"tags":["ipns","name-resolve","http-rpc","unsupported-option"],"backgroundTag":"unsupported-resolve-depth","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"}