gitbutlerapp/gitbutler · error

Command not found!

Error message

Command {command} not found!

What it means

The command dispatcher `handle_command` in but-server falls through its match on the command name and returns this error for any command it does not recognize. It means the client invoked a command string that has no handler arm in the server's dispatch table.

Solutions

  1. Check the exact command name against the match arms in crates/but-server/src/lib.rs handle_command
  2. Update client and server to matching versions so the command exists on both sides
  3. Add the missing match arm in handle_command if you are extending the server
  4. Fix typos in the calling script or SDK call

Example fix

// before
await server.command("get_log_archive_path"); // typo
// after
await server.command("get_logs_archive_path");
Defensive patterns

Strategy: validation

Validate before calling

const KNOWN_COMMANDS = new Set(['get_logs_archive_path', /* ... */]);
if (!KNOWN_COMMANDS.has(command)) throw new Error(`unknown command: ${command}`);

Type guard

function isKnownCommand(c: string): c is KnownCommand {
  return KNOWN_COMMANDS.has(c);
}

Try / catch

try {
  return await server.command(command);
} catch (e) {
  if (String(e).includes('not found!')) {
    console.error(`Command "${command}" unavailable in this server build`);
    return fallbackFor(command);
  }
  throw e;
}

Prevention

When it happens

Trigger: POSTing to `handle_command` (via post_handle_command_with_path) with a command name that is not one of the handled strings, e.g. a typo like 'get_log_archive_path' or a command from a newer/older client than the server.

Common situations: Client/server version mismatch where the app calls a command the server build doesn't implement; typos in custom automation scripts calling the server API; renamed commands after an upgrade.

Related errors


AI-assisted analysis of gitbutlerapp/gitbutler@58e5313667 (2026-09-18). Data as JSON: /api/errors/70cdf1aa17769cbf. Report an issue: GitHub.

Appendix: source

Thrown at crates/but-server/src/lib.rs:1232

        // Zip/Archive commands (need extra)
        "get_project_archive_path" => {
            #[derive(Deserialize)]
            #[serde(rename_all = "camelCase")]
            struct GetProjectArchivePathParams {
                pub project_id: ProjectHandleOrLegacyProjectId,
            }
            let params = serde_json::from_value::<GetProjectArchivePathParams>(request.params)?;
            extra
                .archival
                .zip_entire_repository(params.project_id)
                .map(to_json_or_panic)
        }
        "get_logs_archive_path" => {
            let result = extra.archival.zip_logs();
            result.map(|r| json!(r))
        }
        _ => Err(anyhow::anyhow!("Command {command} not found!")),
    }
}

fn to_json_or_panic(value: impl serde::Serialize) -> serde_json::Value {
    serde_json::to_value(value).unwrap()
}

fn deserialize_json<T: serde::de::DeserializeOwned>(value: serde_json::Value) -> anyhow::Result<T> {
    Ok(serde_json::from_value(value)?)
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn localhost_origin_accepts_valid() {
        // Basic schemes

View on GitHub (pinned to 58e5313667)