n0-computer / iroh

peer-2-peer that just works
https://iroh.computer
Apache License 2.0
2.6k stars 164 forks source link

Unhelpful message when unable to `iroh start` #2241

Open expede opened 7 months ago

expede commented 7 months ago

I managed to solve this one myself, but I didn't see an existing Issue for this so figured I'd file it in case someone else runs into something similar in the future.

I think the root cause is that I had some old Iroh files on my system. Here's the relevant parts of my console history (omitting various troubleshooting steps).

$ nix shell nixpkgs/nixos-unstable#iroh

$ iroh --version
iroh-cli 0.14.0

$ iroh start
Error: Table 'records-by-key-1' does not exist

$ RUST_LOG=info iroh start
2024-04-25T23:51:23.598411Z  INFO iroh_metrics::service: Starting metrics server on 127.0.0.1:9090
⠙ Iroh booting...                                                                                                                                                                                                     2024-04-25T23:51:23.602662Z  INFO iroh_sync::store::fs::migrations: Executed migration migration_004_populate_by_key_index (0 rows affected)
2024-04-25T23:51:23.614849Z  INFO iroh_sync::store::fs::migrate_v1_v2: migrate /Users/expede/Library/Application Support/iroh/docs.redb to /Users/expede/Library/Application Support/iroh/docs.db.migrateSqkBCS
2024-04-25T23:51:23.636360Z  INFO iroh_sync::store::fs::migrate_v1_v2: migrate authors-1 (0 rows)..
2024-04-25T23:51:23.636382Z  INFO iroh_sync::store::fs::migrate_v1_v2: migrate authors-1 done
2024-04-25T23:51:23.636410Z  INFO iroh_sync::store::fs::migrate_v1_v2: migrate namespaces-2 (1 rows)..
2024-04-25T23:51:23.636424Z  INFO iroh_sync::store::fs::migrate_v1_v2: migrate namespaces-2 done
2024-04-25T23:51:23.636438Z  INFO iroh_sync::store::fs::migrate_v1_v2: migrate records-1 (0 rows)..
2024-04-25T23:51:23.636442Z  INFO iroh_sync::store::fs::migrate_v1_v2: migrate records-1 done
2024-04-25T23:51:23.636454Z  INFO iroh_sync::store::fs::migrate_v1_v2: migrate latest-by-author-1 (0 rows)..
2024-04-25T23:51:23.636458Z  INFO iroh_sync::store::fs::migrate_v1_v2: migrate latest-by-author-1 done
Error: Table 'records-by-key-1' does not exist

$ rm -r /Users/expede/Library/Application\ Support/iroh/

$ iroh start
Iroh is running
Node ID: <HIDDEN>

This is absolutely an edge case so likely not high priority. It might be nice to either add a better error message (e.g. "you have an existing install and we failed to migrate") or a CLI command to do a completely fresh install (e.g. iroh clean). I knew that this is a Rust project and thus was able to use RUST_LOG, but a --verbose flag may be more familiar to non-Rustacians.

dignifiedquire commented 7 months ago

thanks, yes we should improve on these error messages