nikivdev/code · error

daemon '{}' not found in config

Error message

daemon '{}' not found in config

What it means

resolve_daemon_config loads the merged daemon configuration and searches for a daemon whose name matches the requested one. If no daemon with that name exists in the (possibly path-overridden) config file, it throws "daemon '{}' not found in config".

Source

Thrown at src/supervisor.rs:1116

}

fn active_path_matches(active: &Option<PathBuf>, candidate: &Path) -> bool {
    match active {
        Some(active_path) => active_path == &normalize_path(candidate),
        None => false,
    }
}

fn normalize_path(path: &Path) -> PathBuf {
    path.canonicalize().unwrap_or_else(|_| path.to_path_buf())
}

fn resolve_daemon_config(name: &str, config_path: Option<&Path>) -> Result<config::DaemonConfig> {
    let cfg = daemon::load_merged_config_with_path(config_path)?;
    cfg.daemons
        .into_iter()
        .find(|daemon| daemon.name == name)
        .ok_or_else(|| anyhow::anyhow!("daemon '{}' not found in config", name))
}

fn register_managed_daemon(
    state: &SharedState,
    daemon_cfg: &config::DaemonConfig,
    config_path: Option<&Path>,
    disabled: bool,
) -> Result<()> {
    let mut state = state.lock().expect("supervisor state lock");
    let key = daemon_key(&daemon_cfg.name, config_path);
    let entry = ManagedDaemon {
        name: daemon_cfg.name.clone(),
        config_path: config_path.map(|path| path.to_path_buf()),
        restart: daemon::restart_policy_for(daemon_cfg),
        retry_remaining: daemon_cfg.retry,
        autostop: daemon_cfg.autostop,
        disabled,
        health_failures: 0,

View on GitHub (pinned to a747e741ae)

Solutions

  1. Run `f daemons` (or inspect the config file) to list valid daemon names and correct the spelling
  2. Confirm you are pointing at the right config file (pass --config explicitly if needed)
  3. Re-add the missing daemon block to the config, then retry the operation
  4. If triggered by a stale managed-daemon record, clean up the supervisor state and re-register

Example fix

// before (CLI)
f disable mydaemon
// after (verify name first)
f daemons            # list names
disable_worker       # use the exact name shown in config
Defensive patterns

Strategy: validation

Validate before calling

let cfg = f_supervisor::daemon::load_merged_config_with_path(config_path)?;
if !cfg.daemons.iter().any(|d| d.name == name) {
    eprintln!("'{}' is not a configured daemon. Available: {:?}", name,
        cfg.daemons.iter().map(|d| &d.name).collect::<Vec<_>>());
    return;
}

Try / catch

match disable_managed_daemon(state, name, config_path) {
    Ok(_) => println!("disabled"),
    Err(e) if e.to_string().contains("not found in config") => {
        eprintln!("unknown daemon '{}'; list names with `f daemons`", name);
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: Calling resolve_daemon_config via handle_request, monitor_daemons, or disable_managed_daemon with a daemon name that is misspelled, was removed from the config, or exists only in a different config file than the one resolved via config_path.

Common situations: Typo in `f disable <name>` or supervisor request; config file edited/renamed daemon while a stale registration references the old name; pointing at the wrong config path via --config so the daemon defined in the default file is invisible.

Related errors


AI-assisted analysis of nikivdev/code@a747e741ae (2026-09-01). Data as JSON: /api/errors/227f9f165a2e453c. Report an issue: GitHub.