gitbutlerapp/gitbutler · error

executable must be specified for non built-ins

Error message

executable must be specified for non built-ins

What it means

For programs that are not one of the recognized built-ins, an `executable` path/command is mandatory — without it there is nothing to launch. Validation rejects the spec as soon as the name/id pairing succeeds but `executable` is None.

Solutions

  1. Set `executable` to the absolute path of the program binary
  2. Verify the program is registered as a built-in if no executable should be needed
  3. Update the client to always send executable for non built-in programs

Example fix

// before
ProgramSpecInput { name: Some("MyEditor".into()), id: None, executable: None }
// after
ProgramSpecInput { name: Some("MyEditor".into()), id: None, executable: Some("/usr/local/bin/myeditor".into()) }
Defensive patterns

Strategy: validation

Validate before calling

if (!isBuiltin(program) && program.executable == null) throw new Error('executable must be specified for non built-ins');

Type guard

function hasExecutable(p: {executable?: string|null}): p is {executable: string} { return typeof p.executable === 'string' && p.executable.length > 0; }

Try / catch

try { await resolveProgram(program); } catch (e) { if (String(e).includes('executable must be specified')) { /* ask user to pick the binary */ } else { throw e; } }

Prevention

When it happens

Trigger: Building a ProgramSpec where the program is not a built-in, `name`/`id` are provided, but `executable` is None.

Common situations: API payloads that only carry a display name for a custom editor, stale client caches referencing removed custom programs, or UI flows that defer executable selection.

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


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

Appendix: source

Thrown at crates/but-api/src/open/program.rs:745

                    .map(Into::into)
                    .unwrap_or_else(|| builtin.executable.clone()),
                category: self
                    .category
                    .map(Into::into)
                    .unwrap_or_else(|| builtin.category.clone()),
                cli_arg_supplier,
                extensions,
            })
        } else {
            let (name, id) = match (self.name, self.id) {
                (Some(name), Some(id)) => (name, id),
                (Some(name), None) => (name.clone(), name),
                (None, Some(id)) => (id.clone(), id),
                (None, None) => anyhow::bail!("id or name must be specified"),
            };

            let Some(executable) = self.executable else {
                anyhow::bail!("executable must be specified for non built-ins")
            };

            Ok(ProgramSpec {
                id,
                name,
                executable: executable.into(),
                category: self.category.map(Into::into).unwrap_or_default(),
                cli_arg_supplier: CliArgumentSupplier::Custom(CustomCliArgumentSupplier {
                    open_args: self.open_args,
                    open_at_line_args: self.open_at_line_args,
                }),
                extensions,
            })
        }
    }
}

/// The executable to invoke for a program.

View on GitHub (pinned to 58e5313667)