{"record":{"id":"70cdf1aa17769cbf","repo":"gitbutlerapp/gitbutler","slug":"command-command-not-found","errorCode":null,"errorMessage":"Command {command} not found!","messagePattern":"Command (.+?) not found!","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/but-server/src/lib.rs","lineNumber":1237,"sourceCode":"\n        // Zip/Archive commands (need extra)\n        \"get_project_archive_path\" => {\n            #[derive(Deserialize)]\n            #[serde(rename_all = \"camelCase\")]\n            struct GetProjectArchivePathParams {\n                pub project_id: ProjectHandleOrLegacyProjectId,\n            }\n            let params = serde_json::from_value::<GetProjectArchivePathParams>(request.params)?;\n            extra\n                .archival\n                .zip_entire_repository(params.project_id)\n                .map(to_json_or_panic)\n        }\n        \"get_logs_archive_path\" => {\n            let result = extra.archival.zip_logs();\n            result.map(|r| json!(r))\n        }\n        _ => Err(anyhow::anyhow!(\"Command {command} not found!\")),\n    }\n}\n\nfn to_json_or_panic(value: impl serde::Serialize) -> serde_json::Value {\n    serde_json::to_value(value).unwrap()\n}\n\nfn deserialize_json<T: serde::de::DeserializeOwned>(value: serde_json::Value) -> anyhow::Result<T> {\n    Ok(serde_json::from_value(value)?)\n}\n\n#[cfg(test)]\nmod tests {\n    use super::*;\n\n    #[test]\n    fn localhost_origin_accepts_valid() {\n        // Basic schemes","sourceCodeStart":1219,"sourceCodeEnd":1255,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/caf1f223d3cfb94488c9198ad34487c6006c648f/crates/but-server/src/lib.rs#L1219-L1255","documentation":"but-server's command dispatcher (a large match on the incoming command string) fell through to the default arm, meaning the request named a command the server build does not implement. The server is versioned independently of clients (desktop, Electron/N-API, CLI, SDK), so this is almost always a client/server version skew or a typo in the command name.","triggerScenarios":"Sending a JSON request whose `command` string is not one of the matched arms (e.g. 'get_projct_archive_path' misspelled), or a newer client calling a command (e.g. 'get_logs_archive_path') against an older but-server binary that predates it.","commonSituations":"Mixed-version setups: an updated app front end talking to a stale background server process; copying command names from newer docs or changelogs into scripts targeting an older release; leftover server process still running after an upgrade.","solutions":["Check the exact command string sent by the client for typos/casing against the match arms in crates/but-server/src/lib.rs","Verify client and server are the same release (restart the app/server so both run the current build)","If you control the caller, confirm the command exists in your server version's dispatcher before sending"],"exampleFix":"// before\nlet resp = client.request(\"get_logs_archive_path\", json!({})).send();\n// after — verify the command is supported by this server build first\nconst KNOWN = await client.listCommands(); // or check server version\nif (!KNOWN.includes(\"get_logs_archive_path\")) {\n  throw new Error(`server ${client.serverVersion} lacks command 'get_logs_archive_path' — update server`);\n}","handlingStrategy":"validation","validationCode":"// before sending, confirm the command exists in this server build\nconst supported = await client.invoke(\"list_commands\"); // or pin client/server versions\nif (!supported.includes(commandName)) {\n  throw new Error(`Command ${commandName} not supported by server — upgrade server or fix name`);\n}","typeGuard":null,"tryCatchPattern":"catch (e) { if (/Command .* not found/.test(e.message)) { /* version skew: report upgrade needed */ } throw e; }","preventionTips":["Ship client and but-server in lockstep; check server version handshake at connect","Keep command-name constants in one shared module instead of string literals","Log the exact command string on dispatch failure to catch typos fast"],"tags":["rust","rpc","dispatch","version-skew","but-server"],"backgroundTag":"unknown-rpc-method","analyzedSha":"caf1f223d3cfb94488c9198ad34487c6006c648f","analyzedAt":"2026-08-20T07:55:40.983Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}