ipfs/kubo · error · errors.New

ipfs configuration file already exists! Reinitializing would

Error message

ipfs configuration file already exists!
Reinitializing would overwrite your keys

What it means

Sentinel error (errRepoExists) returned by the init command when fsrepo.IsInitialized finds an existing repo at the repo root. It is a safety guard: reinitializing would overwrite the node's identity keys, so 'ipfs init' refuses rather than destroying them.

Source

Thrown at cmd/ipfs/kubo/init.go:36

	fsrepo "github.com/ipfs/kubo/repo/fsrepo"

	"github.com/ipfs/boxo/files"
	cmds "github.com/ipfs/go-ipfs-cmds"
	config "github.com/ipfs/kubo/config"
	options "github.com/ipfs/kubo/core/coreiface/options"
)

const (
	algorithmDefault    = options.Ed25519Key
	algorithmOptionName = "algorithm"
	bitsOptionName      = "bits"
	emptyRepoDefault    = true
	emptyRepoOptionName = "empty-repo"
	profileOptionName   = "profile"
)

// nolint
var errRepoExists = errors.New(`ipfs configuration file already exists!
Reinitializing would overwrite your keys
`)

var initCmd = &cmds.Command{
	Helptext: cmds.HelpText{
		Tagline: "Initializes ipfs config file.",
		ShortDescription: `
Initializes ipfs configuration files and generates a new keypair.

If you are going to run IPFS in server environment, you may want to
initialize it using 'server' profile.

For the list of available profiles see 'ipfs config profile --help'

ipfs uses a repository in the local file system. By default, the repo is
located at ~/.ipfs. To change the repo location, set the $IPFS_PATH
environment variable:

View on GitHub (pinned to 329838acdf)

Solutions

  1. Use the existing repo as-is
  2. Move or delete the old repo directory (or set IPFS_PATH elsewhere) and re-run init
  3. If a fresh identity is truly wanted, back up the old config first, then remove the repo
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at cmd/ipfs/kubo/init.go:36 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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