{"record":{"id":"7c383604e8d4211c","repo":"ipfs/kubo","slug":"q-is-not-an-ipns-name","errorCode":null,"errorMessage":"%q is not an IPNS name","messagePattern":"%q is not an IPNS name","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/coreapi/name.go","lineNumber":145,"sourceCode":"\n\t// Accept a bare IPNS name (key or DNSLink), an /ipns/ path, or a native IPNS\n\t// URI (ipns://name, ipns:name).\n\tp, err := path.NewPathFromURI(name)\n\tif err != nil {\n\t\t// Wrap a bare name (no leading slash) as an /ipns/ path. Anything already\n\t\t// in path form that failed to parse keeps its original error rather than\n\t\t// being mangled by a second \"/ipns/\" prefix.\n\t\tif strings.HasPrefix(name, \"/\") {\n\t\t\treturn nil, err\n\t\t}\n\t\tp, err = path.NewPath(\"/ipns/\" + name)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\t// name resolution is IPNS-only; reject immutable /ipfs and /ipld inputs.\n\tif p.Namespace() != path.IPNSNamespace {\n\t\treturn nil, fmt.Errorf(\"%q is not an IPNS name\", name)\n\t}\n\n\tout := make(chan coreiface.IpnsResult)\n\tgo func() {\n\t\tdefer close(out)\n\t\tfor res := range resolver.ResolveAsync(ctx, p, options.ResolveOpts...) {\n\t\t\tselect {\n\t\t\tcase out <- coreiface.IpnsResult{Path: res.Path, Err: res.Err}:\n\t\t\tcase <-ctx.Done():\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}()\n\n\treturn out, nil\n}\n\n// Resolve attempts to resolve the newest version of the specified name and","sourceCodeStart":127,"sourceCodeEnd":163,"githubUrl":"https://github.com/ipfs/kubo/blob/329838acdfafae224582930457efe80aa217afc0/core/coreapi/name.go#L127-L163","documentation":"KeyAPI(name.go).Search only resolves IPNS names. If the parsed path's namespace is not /ipns/ (e.g. /ipfs/ or /ipld/ immutable paths), Search rejects it with this error, since immutable content has nothing to search for.","triggerScenarios":"Calling KeyAPI.Search(ctx, name) with a path whose namespace is /ipfs/ or /ipld/, e.g. Search(ctx, \"/ipfs/bafy...\") or a bare CID parsed as an immutable path.","commonSituations":"Confusing name search with content lookup: passing a content CID instead of an IPNS name; passing a fully-qualified /ipfs/ gateway-style path.","solutions":["Pass an IPNS name (k51... style name or /ipns/<name>) instead of an /ipfs/ path.","If you want the content of an immutable path, use the Unix filesystem/DAG API, not name Search.","Validate the namespace of user input before calling Search."],"exampleFix":"// before\nres, err := api.Name().Search(ctx, \"/ipfs/bafybeig...\")\n// after\nres, err := api.Name().Search(ctx, \"/ipns/k51qzi5uqu5d...\")","handlingStrategy":"validation","validationCode":"p, err := path.NewPath(name)\nif err == nil && p.Namespace() != \"/ipns\" {\n    return fmt.Errorf(\"Search requires an /ipns/ name, got %s\", p.Namespace())\n}","typeGuard":"func isIPNSName(s string) bool {\n    p, err := path.NewPath(s)\n    return err == nil && p.Namespace() == path.IPNSNamespace\n}","tryCatchPattern":"res, err := api.Name().Search(ctx, name)\nif err != nil && strings.Contains(err.Error(), \"is not an IPNS name\") {\n    return fmt.Errorf(\"%q must be an IPNS name, not content\", name)\n}","preventionTips":["Only pass IPNS names (k51...) to Search.","Resolve /ipfs/ inputs through the DAG/UnixFS APIs instead.","Validate namespace of user input before calling."],"tags":["ipns","path","validation"],"backgroundTag":"not-an-ipns-name","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"}