{"record":{"id":"51bf355f5b4387c4","repo":"ipfs/kubo","slug":"error-resolving-path-s","errorCode":null,"errorMessage":"error resolving path: %s","messagePattern":"error resolving path: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/coreapi/pin.go","lineNumber":78,"sourceCode":"\tspan.SetAttributes(attribute.String(\"type\", settings.Type))\n\n\tswitch settings.Type {\n\tcase \"all\", \"direct\", \"indirect\", \"recursive\":\n\tdefault:\n\t\tclose(pins)\n\t\treturn fmt.Errorf(\"invalid type '%s', must be one of {direct, indirect, recursive, all}\", settings.Type)\n\t}\n\n\treturn api.pinLsAll(ctx, settings.Type, settings.Detailed, settings.Name, pins)\n}\n\nfunc (api *PinAPI) IsPinned(ctx context.Context, p path.Path, opts ...caopts.PinIsPinnedOption) (string, bool, error) {\n\tctx, span := tracing.Span(ctx, \"CoreAPI.PinAPI\", \"IsPinned\", trace.WithAttributes(attribute.String(\"path\", p.String())))\n\tdefer span.End()\n\n\tresolved, _, err := api.core().ResolvePath(ctx, p)\n\tif err != nil {\n\t\treturn \"\", false, fmt.Errorf(\"error resolving path: %s\", err)\n\t}\n\n\tsettings, err := caopts.PinIsPinnedOptions(opts...)\n\tif err != nil {\n\t\treturn \"\", false, err\n\t}\n\n\tspan.SetAttributes(attribute.String(\"withtype\", settings.WithType))\n\n\tmode, ok := pin.StringToMode(settings.WithType)\n\tif !ok {\n\t\treturn \"\", false, fmt.Errorf(\"invalid type '%s', must be one of {direct, indirect, recursive, all}\", settings.WithType)\n\t}\n\n\treturn api.pinning.IsPinnedWithType(ctx, resolved.RootCid(), mode)\n}\n\n// Rm pin rm api","sourceCodeStart":60,"sourceCodeEnd":96,"githubUrl":"https://github.com/ipfs/kubo/blob/329838acdfafae224582930457efe80aa217afc0/core/coreapi/pin.go#L60-L96","documentation":"IsPinned must resolve the path to its CID before checking the pinset; resolution failure is wrapped with 'error resolving path: '. Causes come from ResolvePath: unsupported namespace, malformed path, or missing blocks.","triggerScenarios":"Calling Pin().IsPinned with an /ipns/ path, a nonexistent/unresolvable CID, or a path whose content is not present and cannot be fetched.","commonSituations":"Checking pin status of an IPNS name; checking a CID the node never fetched while offline; typo'd path.","solutions":["Read the wrapped cause to identify the resolution failure","Resolve IPNS names first and check the resulting /ipfs/ path","Fetch or connect to retrieve missing content before checking","Prefer IsPinned over a resolved-CID variant when you already have the CID"],"exampleFix":"// before\n_, pinned, _ := api.Pin().IsPinned(ctx, path.New(\"/ipns/example.com\"))\n// after\np := path.New(\"/ipns/example.com\")\nnd, err := api.ResolveNode(ctx, p)\nif err != nil { return err }\n_, pinned, err = api.Pin().IsPinned(ctx, path.FromCid(nd.Cid()))","handlingStrategy":"try-catch","validationCode":"p := path.New(pstring)\nif ns := p.Namespace(); ns != path.IPFSNamespace && ns != path.IPLDNamespace {\n    // resolve /ipns/ first\n}","typeGuard":"func isDirectPinPath(p path.Path) bool {\n\treturn p.Namespace() == path.IPFSNamespace || p.Namespace() == path.IPLDNamespace\n}","tryCatchPattern":"_, pinned, err := api.Pin().IsPinned(ctx, p)\nif err != nil {\n    if strings.HasPrefix(err.Error(), \"error resolving path: \") {\n        // resolve IPNS / fetch content, then retry with the /ipfs/ path\n    }\n    return err\n}","preventionTips":["Resolve IPNS names before checking pin status","Have the CID locally (or connectivity) before IsPinned","Prefer checking with an already-resolved /ipfs/ path"],"tags":["pin","path-resolution","error-wrapping"],"backgroundTag":"pin-path-resolution-failed","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"}