ipfs/kubo · error

error resolving path: %s

Error message

error resolving path: %s

What it means

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.

Source

Thrown at core/coreapi/pin.go:78

	span.SetAttributes(attribute.String("type", settings.Type))

	switch settings.Type {
	case "all", "direct", "indirect", "recursive":
	default:
		close(pins)
		return fmt.Errorf("invalid type '%s', must be one of {direct, indirect, recursive, all}", settings.Type)
	}

	return api.pinLsAll(ctx, settings.Type, settings.Detailed, settings.Name, pins)
}

func (api *PinAPI) IsPinned(ctx context.Context, p path.Path, opts ...caopts.PinIsPinnedOption) (string, bool, error) {
	ctx, span := tracing.Span(ctx, "CoreAPI.PinAPI", "IsPinned", trace.WithAttributes(attribute.String("path", p.String())))
	defer span.End()

	resolved, _, err := api.core().ResolvePath(ctx, p)
	if err != nil {
		return "", false, fmt.Errorf("error resolving path: %s", err)
	}

	settings, err := caopts.PinIsPinnedOptions(opts...)
	if err != nil {
		return "", false, err
	}

	span.SetAttributes(attribute.String("withtype", settings.WithType))

	mode, ok := pin.StringToMode(settings.WithType)
	if !ok {
		return "", false, fmt.Errorf("invalid type '%s', must be one of {direct, indirect, recursive, all}", settings.WithType)
	}

	return api.pinning.IsPinnedWithType(ctx, resolved.RootCid(), mode)
}

// Rm pin rm api

View on GitHub (pinned to 329838acdf)

Solutions

  1. Read the wrapped cause to identify the resolution failure
  2. Resolve IPNS names first and check the resulting /ipfs/ path
  3. Fetch or connect to retrieve missing content before checking
  4. Prefer IsPinned over a resolved-CID variant when you already have the CID

Example fix

// before
_, pinned, _ := api.Pin().IsPinned(ctx, path.New("/ipns/example.com"))
// after
p := path.New("/ipns/example.com")
nd, err := api.ResolveNode(ctx, p)
if err != nil { return err }
_, pinned, err = api.Pin().IsPinned(ctx, path.FromCid(nd.Cid()))
Defensive patterns

Strategy: try-catch

Validate before calling

p := path.New(pstring)
if ns := p.Namespace(); ns != path.IPFSNamespace && ns != path.IPLDNamespace {
    // resolve /ipns/ first
}

Type guard

func isDirectPinPath(p path.Path) bool {
	return p.Namespace() == path.IPFSNamespace || p.Namespace() == path.IPLDNamespace
}

Try / catch

_, pinned, err := api.Pin().IsPinned(ctx, p)
if err != nil {
    if strings.HasPrefix(err.Error(), "error resolving path: ") {
        // resolve IPNS / fetch content, then retry with the /ipfs/ path
    }
    return err
}

Prevention

When it happens

Trigger: Calling Pin().IsPinned with an /ipns/ path, a nonexistent/unresolvable CID, or a path whose content is not present and cannot be fetched.

Common situations: Checking pin status of an IPNS name; checking a CID the node never fetched while offline; typo'd path.

Related errors


AI-assisted analysis of ipfs/kubo@329838acdf (2026-09-03). Data as JSON: /api/errors/51bf355f5b4387c4. Report an issue: GitHub.