{"record":{"id":"62d3ab3c5b165ebe","repo":"linera-io/linera-protocol","slug":"please-specify-one-of-faucet-or-genesis","errorCode":null,"errorMessage":"please specify one of `--faucet` or `--genesis`.","messagePattern":"please specify one of `--faucet` or `--genesis`\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"linera-service/src/cli/main.rs","lineNumber":2668,"sourceCode":"                         switch to another chain with `wallet set-default` first\"\n                    );\n                }\n                wallet\n                    .remove(*chain_id)?\n                    .ok_or_else(|| anyhow::anyhow!(\"nonexistent chain `{chain_id}`\"))?;\n                info!(\"Chain forgotten in {} ms\", start_time.elapsed().as_millis());\n                Ok(0)\n            }\n\n            WalletCommand::Init {\n                genesis_config_path,\n                faucet,\n                testing_prng_seed,\n            } => {\n                let start_time = Instant::now();\n                let genesis_config: GenesisConfig = match (genesis_config_path, faucet) {\n                    (None, None) => {\n                        anyhow::bail!(\"please specify one of `--faucet` or `--genesis`.\")\n                    }\n                    (Some(genesis_config_path), _) => util::read_json(genesis_config_path)?,\n                    (None, Some(url)) => {\n                        let faucet = cli_wrappers::Faucet::new(url.clone());\n                        let version_info = faucet\n                            .version_info()\n                            .await\n                            .context(\"Failed to obtain version information from the faucet\")?;\n                        if !version_info.is_compatible_with(&linera_version::VERSION_INFO) {\n                            warn!(\n                                \"\\\nMake sure to use a Linera client compatible with this network.\n--- Faucet info ---\\\n{}\\\n-------------------\n--- This binary ---\\\n{}\\\n-------------------\",","sourceCodeStart":2650,"sourceCodeEnd":2686,"githubUrl":"https://github.com/linera-io/linera-protocol/blob/6c226ddcb332ef55118dc8d0aafbd093d5420899/linera-service/src/cli/main.rs#L2650-L2686","documentation":"This command path builds a GenesisConfig from exactly one source: a local genesis file (`--genesis <path>`, read via `util::read_json`) or a faucet URL (`--faucet <url>`, fetched and validated via `faucet.version_info()`). The `(None, None)` arm of the match bails when neither flag is supplied. If both are supplied, the `--genesis` file takes precedence.","triggerScenarios":"Invoking the command with neither `--faucet` nor `--genesis` resolved to a value — flags omitted, misspelled, or left None by a config file that was expected to provide them.","commonSituations":"New users following a tutorial that assumes a config file already carries a faucet URL; typos in flag names so clap leaves the fields None; automation that conditionally passes neither option on some branch.","solutions":["Pass a faucet URL: `--faucet https://<faucet-host>`","Or pass a local genesis file: `--genesis <path/to/genesis.json>`","If both are set, remove the one you do not want (genesis wins over faucet)"],"exampleFix":"# before\nlinera net up --with-faucet   # no --faucet/--genesis -> bail\n\n# after\nlinera net up --faucet https://faucet.testnet.linera.net --with-faucet","handlingStrategy":"validation","validationCode":"// Validate before invoking the command.\nlet genesis_source = match (genesis_config_path, faucet_url) {\n    (Some(p), _) => GenesisSource::File(p),\n    (None, Some(u)) => GenesisSource::Faucet(u),\n    (None, None) => anyhow::bail!(\"provide either --faucet or --genesis\"),\n};","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Make your launcher fail fast on missing flags instead of relying on the CLI's late bail","When configs are supposed to supply the faucet URL, assert the resolved value is non-empty before spawn","Remember that if both flags are present, --genesis wins — remove the unwanted one to avoid surprises"],"tags":["cli","genesis","faucet","argument-validation","linera-cli"],"backgroundTag":"missing-required-cli-option","analyzedSha":"6c226ddcb332ef55118dc8d0aafbd093d5420899","analyzedAt":"2026-08-22T22:49:09.787Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}