{"record":{"id":"a3ce7a3a74590b75","repo":"ipfs/kubo","slug":"identity-was-not-set-in-config-was-ipfs-init-ru","errorCode":null,"errorMessage":"identity was not set in config (was 'ipfs init' run?)","messagePattern":"identity was not set in config \\(was 'ipfs init' run\\?\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"core/node/groups.go","lineNumber":273,"sourceCode":"\t\tfx.Provide(RepoConfig),\n\t\tfx.Provide(Datastore),\n\t\tfx.Provide(BaseBlockstoreCtor(\n\t\t\tcacheOpts,\n\t\t\tcfg.Datastore.HashOnRead,\n\t\t\tcfg.Datastore.WriteThrough.WithDefault(config.DefaultWriteThrough),\n\t\t\tcfg.Provide.Strategy.WithDefault(config.DefaultProvideStrategy),\n\t\t)),\n\t\tfinalBstore,\n\t)\n}\n\n// Identity groups units providing cryptographic identity\nfunc Identity(cfg *config.Config) fx.Option {\n\t// PeerID\n\n\tcid := cfg.Identity.PeerID\n\tif cid == \"\" {\n\t\treturn fx.Error(errors.New(\"identity was not set in config (was 'ipfs init' run?)\"))\n\t}\n\tif len(cid) == 0 {\n\t\treturn fx.Error(errors.New(\"no peer ID in config! (was 'ipfs init' run?)\"))\n\t}\n\n\tid, err := peer.Decode(cid)\n\tif err != nil {\n\t\treturn fx.Error(fmt.Errorf(\"peer ID invalid: %s\", err))\n\t}\n\n\t// Private Key\n\n\tif cfg.Identity.PrivKey == \"\" {\n\t\treturn fx.Options( // No PK (usually in tests)\n\t\t\tfx.Provide(PeerID(id)),\n\t\t\tfx.Provide(libp2p.Peerstore),\n\t\t)\n\t}","sourceCodeStart":255,"sourceCodeEnd":291,"githubUrl":"https://github.com/ipfs/kubo/blob/329838acdfafae224582930457efe80aa217afc0/core/node/groups.go#L255-L291","documentation":"Kubo requires a cryptographic identity in the repo config; the PeerID string is empty, meaning the Identity section is missing. The fx graph for the node cannot be built without a peer identity, so node construction fails immediately with this message hinting that `ipfs init` was never run (or the config lost Identity).","triggerScenarios":"`cfg.Identity.PeerID == \"\"` when the Identity fx group builds — empty repo, config file replaced, or Identity key deleted.","commonSituations":"Running kubo without `ipfs init`; pointing IPFS_PATH at an empty or wrong directory; manually editing config.json and removing Identity; restoring only part of a repo backup.","solutions":["Run `ipfs init` in the configured IPFS_PATH to create a fresh identity","Verify IPFS_PATH points at the intended repo (`ipfs repo stat`)","Restore the Identity section (PeerID and PrivKey) from a backup of the original config"],"exampleFix":"// before\nIPFS_PATH=/nonexistent ipfs daemon\n// Error: identity was not set in config (was 'ipfs init' run?)\n// after\nexport IPFS_PATH=~/.ipfs\nipfs init   # only if the repo does not exist\nipfs daemon","handlingStrategy":"validation","validationCode":"if cfg.Identity == nil || cfg.Identity.PeerID == \"\" {\n\t// run `ipfs init` or load the correct repo before constructing the node\n\treturn errors.New(\"repo missing Identity.PeerID; run ipfs init\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always run `ipfs init` on a fresh IPFS_PATH","Verify IPFS_PATH points at an initialized repo before starting daemons","Back up the Identity section of config.json"],"tags":["config","identity","initialization"],"backgroundTag":"missing-identity-config","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"}