{"record":{"id":"2dcb683abed3b18f","repo":"spacedriveapp/spacedrive","slug":"unknown-config-key","errorCode":null,"errorMessage":"Unknown config key: {}","messagePattern":"Unknown config key: (.+?)","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"critical","filePath":"apps/cli/src/domains/config/mod.rs","lineNumber":61,"sourceCode":"\t\t\ttable.add_row(vec![\"update.repo\", &config.update.repo]);\n\t\t\ttable.add_row(vec![\"update.channel\", &config.update.channel]);\n\n\t\t\tprintln!(\"{}\", table);\n\t\t\tprintln!();\n\t\t\tprintln!(\n\t\t\t\t\"Config file: {}\",\n\t\t\t\tCliConfig::config_path(&data_dir).display()\n\t\t\t);\n\t\t}\n\t\tConfigCmd::Get { key } => {\n\t\t\tlet value = match key.as_str() {\n\t\t\t\t\"current_library_id\" => config\n\t\t\t\t\t.current_library_id\n\t\t\t\t\t.map(|id| id.to_string())\n\t\t\t\t\t.unwrap_or_else(|| \"(not set)\".to_string()),\n\t\t\t\t\"update.repo\" => config.update.repo.clone(),\n\t\t\t\t\"update.channel\" => config.update.channel.clone(),\n\t\t\t\t_ => return Err(anyhow::anyhow!(\"Unknown config key: {}\", key)),\n\t\t\t};\n\t\t\tprintln!(\"{}\", value);\n\t\t}\n\t\tConfigCmd::Set { key, value } => match key.as_str() {\n\t\t\t\"update.repo\" => {\n\t\t\t\tconfig.set_update_repo(value.clone(), &data_dir)?;\n\t\t\t\tprintln!(\"Set update.repo = {}\", value);\n\t\t\t}\n\t\t\t\"update.channel\" => {\n\t\t\t\tconfig.set_update_channel(value.clone(), &data_dir)?;\n\t\t\t\tprintln!(\"Set update.channel = {}\", value);\n\t\t\t}\n\t\t\t_ => return Err(anyhow::anyhow!(\"Cannot set key: {}\", key)),\n\t\t},\n\t}\n\n\tOk(())\n}","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/spacedriveapp/spacedrive/blob/6dfeccf2113039e35f2ce735f945e70dc3e4ea45/apps/cli/src/domains/config/mod.rs#L43-L79","documentation":"Wrapper error thrown when NetworkingService::new(device_manager, key_manager, data_dir, logger) fails during service initialization. The inner error string after the colon carries the actual cause — typically key-manager/crypto setup failures, data-dir I/O problems, or p2p stack (node identity) creation errors. On failure self.networking stays None, so later networking calls see an uninitialized service.","triggerScenarios":"Calling the init function at service/mod.rs:189 during daemon startup with an unreadable/unwritable data_dir, an uninitialized or corrupt key manager state, or missing OS networking prerequisites for the p2p stack.","commonSituations":"Fresh environment where the data dir permissions are wrong (daemon runs as different user); corrupted persisted node keys from a crash; containerized deployment missing /dev/net or required capabilities; disk full.","solutions":["Read the inner error text after the colon — it identifies which subsystem failed.","Verify the data dir passed to init exists and is writable by the daemon user.","Check key manager state files are present/valid (or remove them to force re-provisioning if re-pairing is acceptable).","Re-run the daemon with RUST_LOG=sd_core::service=debug to get detailed initialization logs."],"exampleFix":"# before\nls -la /var/lib/sd   # owned by root, daemon runs as 'sd'\n\n# after\nchown -R sd:sd /var/lib/sd && systemctl restart sd-daemon","handlingStrategy":"try-catch","validationCode":"// Pre-flight the data dir before initializing networking.\nuse std::path::Path;\n\nfn data_dir_ready(p: &Path) -> bool {\n    p.exists() && p.is_dir() && writable(p)\n}\n\nfn writable(p: &Path) -> bool {\n    std::fs::File::create(p.join(\".writecheck\")).and_then(|f| std::fs::remove_file(p.join(\".writecheck\")).map(|_| f)).is_ok()\n}","typeGuard":null,"tryCatchPattern":"match services.init_networking(device_mgr, key_mgr, &data_dir).await {\n    Ok(()) => {}\n    Err(e) => {\n        tracing::error!(error = %e, \"networking init failed; continuing without P2P\");\n        // degrade gracefully: mark networking unavailable, surface in health\n    }\n}","preventionTips":["Provision data-dir ownership/permissions in deployment (chown to daemon user).","Fail startup loudly with the inner error; do not swallow the wrapper without logging the cause.","Health-check networking availability (services.networking().is_some()) before offering sync features."],"tags":["rust","networking","initialization","p2p","wrapper-error"],"backgroundTag":null,"analyzedSha":"6dfeccf2113039e35f2ce735f945e70dc3e4ea45","analyzedAt":"2026-08-16T11:26:17.074Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}