nikivdev/code · error
--follow requires specifying --server <name>
Error message
--follow requires specifying --server <name>
What it means
The logs command refuses to run in --follow mode without naming a server, because following requires a specific log stream to attach to; there is no defined behavior for following all servers. It is a usage-validation error thrown at the very start of `run` before any network activity.
Source
Thrown at src/logs.rs:17
use std::{
io::{BufRead, BufReader},
thread,
time::Duration,
};
use anyhow::{Context, Result, bail};
use reqwest::blocking::Client;
use crate::{
cli::LogsOpts,
servers::{LogLine, LogStream, ServerSnapshot},
};
pub fn run(opts: LogsOpts) -> Result<()> {
if opts.follow && opts.server.is_none() {
bail!("--follow requires specifying --server <name>");
}
let base_url = format!("http://{}:{}", opts.host, opts.port);
let use_color = !opts.no_color;
let client = Client::builder()
.timeout(std::time::Duration::from_secs(5))
.build()
.context("failed to build HTTP client")?;
if let Some(server) = opts.server.as_deref() {
if opts.follow {
stream_server_logs(server, opts.host, opts.port, use_color)?;
} else {
let logs = fetch_logs(&client, &base_url, server, opts.limit)?;
print_logs(&logs, use_color);
}
return Ok(());
}View on GitHub (pinned to a747e741ae)
Solutions
- Pass the server name: `flow logs --follow --server <name>`.
- Run `flow servers` (or equivalent list command) to see available server names first.
- If you just want a one-shot dump of all logs, drop `--follow`.
Example fix
// before flow logs --follow // after flow logs --follow --server my-server
Defensive patterns
Strategy: validation
Validate before calling
if opts.follow && opts.server.is_none() {
eprintln!("--follow requires --server <name>");
std::process::exit(2);
} Type guard
fn follow_target_valid(opts: &LogsOpts) -> bool {
!opts.follow || opts.server.as_deref().map(|s| !s.is_empty()).unwrap_or(false)
} Try / catch
match logs::run(opts) {
Err(e) if e.to_string().contains("--follow requires") => {
eprintln!("Usage: flow logs --follow --server <name>");
std::process::exit(2);
}
other => other?,
} Prevention
- Always pair --follow with --server in scripts and aliases.
- List available servers before following to confirm the name.
- Wrap the logs command in a helper that injects the server name.
When it happens
Trigger: Invoking `flow logs --follow` (or setting LogsOpts.follow = true) while leaving LogsOpts.server as None.
Common situations: Typing the follow flag but forgetting the server name; scripting the logs command with a variable server name that ends up empty.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- sessions requires a specific provider (claude or codex)
- continue requires a specific provider (claude or codex)
- --all cannot be combined with HASH. Use `f commit-queue appr
- --path cannot be used with --no-commit or --hash
- unknown `f pr feedback` option: {token}
AI-assisted analysis of nikivdev/code@a747e741ae (2026-09-01).
Data as JSON: /api/errors/7fddb57c2c4f9726.
Report an issue: GitHub.