zed-industries/zed · error · anyhow::Error

usage: collab <version | serve <api|collab|all>>

Error message

usage: collab <version | serve <api|collab|all>>

What it means

The collab binary's argument parser matched no known subcommand; the usage line enumerates the accepted forms (version, serve api/collab/all). This is a CLI usage error caused by an unrecognized or missing argument.

Solutions

  1. Run `collab version` or `collab serve <api|collab|all>` with a valid mode
  2. Check for typos in the subcommand
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/collab/src/main.rs:52 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of zed-industries/zed@9d272b0363 (2026-08-20). Data as JSON: /api/errors/575130ff8f12b5a2. Report an issue: GitHub.

Appendix: source

Thrown at crates/collab/src/main.rs:52

    if let Err(error) = env::load_dotenv() {
        eprintln!(
            "error loading .env.toml (this is expected in production): {}",
            error
        );
    }

    let mut args = args().skip(1);
    match args.next().as_deref() {
        Some("version") => {
            println!("collab v{} ({})", VERSION, REVISION.unwrap_or("unknown"));
        }
        Some("serve") => {
            let mode = match args.next().as_deref() {
                Some("collab") => ServiceMode::Collab,
                Some("api") => ServiceMode::Api,
                Some("all") => ServiceMode::All,
                _ => {
                    return Err(anyhow!("usage: collab <version | serve <api|collab|all>>"))?;
                }
            };

            let config = envy::from_env::<Config>().expect("error loading config");
            init_tracing(&config);
            init_panic_hook();

            let mut app = Router::new()
                .route("/", get(handle_root))
                .route("/healthz", get(handle_liveness_probe))
                .layer(Extension(mode));

            let listener = TcpListener::bind(format!("0.0.0.0:{}", config.http_port))
                .expect("failed to bind TCP listener");

            let mut on_shutdown = None;

            if mode.is_collab() || mode.is_api() {

View on GitHub (pinned to 9d272b0363)