{"record":{"id":"40318b9e1a6e663d","repo":"gitbutlerapp/gitbutler","slug":"id-or-name-must-be-specified","errorCode":null,"errorMessage":"id or name must be specified","messagePattern":"id or name must be specified","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/but-api/src/open/program.rs","lineNumber":741,"sourceCode":"                id: id.clone(),\n                name: self.name.unwrap_or_else(|| builtin.name.clone()),\n                executable: self\n                    .executable\n                    .map(Into::into)\n                    .unwrap_or_else(|| builtin.executable.clone()),\n                category: self\n                    .category\n                    .map(Into::into)\n                    .unwrap_or_else(|| builtin.category.clone()),\n                cli_arg_supplier,\n                extensions,\n            })\n        } else {\n            let (name, id) = match (self.name, self.id) {\n                (Some(name), Some(id)) => (name, id),\n                (Some(name), None) => (name.clone(), name),\n                (None, Some(id)) => (id.clone(), id),\n                (None, None) => anyhow::bail!(\"id or name must be specified\"),\n            };\n\n            let Some(executable) = self.executable else {\n                anyhow::bail!(\"executable must be specified for non built-ins\")\n            };\n\n            Ok(ProgramSpec {\n                id,\n                name,\n                executable: executable.into(),\n                category: self.category.map(Into::into).unwrap_or_default(),\n                cli_arg_supplier: CliArgumentSupplier::Custom(CustomCliArgumentSupplier {\n                    open_args: self.open_args,\n                    open_at_line_args: self.open_at_line_args,\n                }),\n                extensions,\n            })\n        }","sourceCodeStart":723,"sourceCodeEnd":759,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/58e5313667b857ef39a730e380af31816a7b1768/crates/but-api/src/open/program.rs#L723-L759","documentation":"Input validation when opening a tool/program: neither an id nor a name was supplied to identify which built-in tool to open. The match on (self.name, self.id) reached the arm where both are None and there is no builtin to fall back to, so the CLI cannot determine which tool to launch.","triggerScenarios":"Calling the ProgramSpec builder (resolve/sanitize path for non built-in programs) with neither `name` nor `id` set on the input struct.","commonSituations":"Clients constructing a custom open-with program from partial UI data, deserializing a JSON payload that omitted both identifying fields, or a frontend sending only `executable`.","solutions":["Include at least `name` in the program payload","Or include `id` if the client knows it","If only `executable` is known, derive id/name from the executable path before calling"],"exampleFix":"// before\n{ \"executable\": \"/usr/bin/code\" }\n// after\n{ \"name\": \"Visual Studio Code\", \"id\": \"com.microsoft.vscode\", \"executable\": \"/usr/bin/code\" }","handlingStrategy":"validation","validationCode":"if (program.name == null && program.id == null) throw new Error('id or name must be specified');","typeGuard":"function hasIdentity(p: {name?: string|null, id?: string|null}): boolean { return p.name != null || p.id != null; }","tryCatchPattern":"try { await resolveProgram(program); } catch (e) { if (String(e).includes('id or name must be specified')) { /* prompt user for a name */ } else { throw e; } }","preventionTips":["Always include at least a display name for custom programs","Validate program payloads before sending to the API","Derive name/id from the executable path as a default"],"tags":["validation","missing-field","program-spec"],"backgroundTag":"missing-required-argument","analyzedSha":"58e5313667b857ef39a730e380af31816a7b1768","analyzedAt":"2026-09-18T06:50:32.052Z","contentChangedAt":"2026-09-18T06:50:32.052Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}