{"record":{"id":"ea8e72383c9a6182","repo":"ipfs/kubo","slug":"errnoversion","errorCode":"ErrNoVersion","errorMessage":"no version file found, please run 0-to-1 migration tool.\n","messagePattern":"no version file found, please run 0-to-1 migration tool\\.\n","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"repo/fsrepo/fsrepo.go","lineNumber":52,"sourceCode":"// TODO rename repo lock and hide name.\nconst LockFile = \"repo.lock\"\n\nvar log = logging.Logger(\"fsrepo\")\n\n// RepoVersion is the version number that we are currently expecting to see.\nvar RepoVersion = version.RepoVersion\n\nvar migrationInstructions = `See https://github.com/ipfs/fs-repo-migrations/blob/master/run.md\nSorry for the inconvenience. In the future, these will run automatically.`\n\nvar programTooLowMessage = `Your programs version (%d) is lower than your repos (%d).\nPlease update ipfs to a version that supports the existing repo, or run\na migration in reverse.\n\nSee https://github.com/ipfs/fs-repo-migrations/blob/master/run.md for details.`\n\nvar (\n\tErrNoVersion     = errors.New(\"no version file found, please run 0-to-1 migration tool.\\n\" + migrationInstructions)\n\tErrOldRepo       = errors.New(\"ipfs repo found in old '~/.go-ipfs' location, please run migration tool.\\n\" + migrationInstructions)\n\tErrNeedMigration = errors.New(\"ipfs repo needs migration, please run migration tool.\\n\" + migrationInstructions)\n)\n\ntype NoRepoError struct {\n\tPath string\n}\n\nvar _ error = NoRepoError{}\n\nfunc (err NoRepoError) Error() string {\n\treturn fmt.Sprintf(\"no IPFS repo found in %s.\\nplease run: 'ipfs init'\", err.Path)\n}\n\nconst (\n\tapiFile      = \"api\"\n\tgatewayFile  = \"gateway\"\n\tswarmKeyFile = \"swarm.key\"","sourceCodeStart":34,"sourceCodeEnd":70,"githubUrl":"https://github.com/ipfs/kubo/blob/329838acdfafae224582930457efe80aa217afc0/repo/fsrepo/fsrepo.go#L34-L70","documentation":"fsrepo.open reads the version file inside the repo directory; when that read fails with a not-exist error, ErrNoVersion is returned. It means the directory exists but has no version marker, so fsrepo cannot determine repo compatibility and refuses to operate. The message directs users to run the 0-to-1 migration tool or use a supporting version.","triggerScenarios":"Opening a repo (fsrepo.Open/openDatastoreAt path) at an IPFS_PATH that was initialized by a pre-1.0/very old ipfs or by a tool that created the directory without writing the version file; a partially deleted repo where the version file is gone.","commonSituations":"Pointing IPFS_PATH at an ancient ~/.go-ipfs-era repo; manually copying a repo directory but omitting hidden files like the version file; crash or manual cleanup leaving a truncated repo; mounting a volume with an incomplete repo.","solutions":["Run the fs-repo-migrations tool starting at the 0-to-1 migration (see https://github.com/ipfs/fs-repo-migrations/blob/master/run.md)","If the directory is not a real repo, run `ipfs init` to create a fresh repo with a version file, or point IPFS_PATH at the correct repo","Restore the missing version file from backup if the repo was partially copied/deleted","Check you did not set IPFS_PATH to an empty or wrong directory"],"exampleFix":"// before (shell)\nIPFS_PATH=/old/repo ipfs daemon  # error: no version file\n// after (shell)\nipfs fs-repo-migrations -to 1    # or restore/init the repo\nIPFS_PATH=/old/repo ipfs daemon","handlingStrategy":"try-catch","validationCode":"// before opening via fsrepo\nif _, err := os.Stat(filepath.Join(ipfsPath, \"version\")); os.IsNotExist(err) {\n\t// repo has no version file: run migrations or ipfs init first\n}","typeGuard":"func repoHasVersion(path string) bool {\n\t_, err := os.Stat(filepath.Join(path, \"version\"))\n\treturn err == nil\n}","tryCatchPattern":"r, err := fsrepo.Open(ipfsPath)\nif err != nil {\n\tif errors.Is(err, fsrepo.ErrNoVersion) {\n\t\t// run fs-repo-migrations or ipfs init; do not retry blindly\n\t\treturn fmt.Errorf(\"%w (run fs-repo-migrations or ipfs init)\", err)\n\t}\n\tif errors.Is(err, fsrepo.ErrNeedMigration) {\n\t\t// run the migration tool for this version gap\n\t}\n\treturn err\n}","preventionTips":["Never delete or omit the version file when copying repo directories","Use `ipfs init` to create new repos instead of hand-crafting directories","Run fs-repo-migrations whenever the kubo version requires a repo migration","Verify IPFS_PATH points at a complete repo before starting the daemon"],"tags":["fsrepo","repo-version","migration","init"],"backgroundTag":"repo-version-missing","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"}