calesthio/OpenMontage · error · DependencyError

Command {cmd_name!r} not found. {self.install_instructions}

Error message

Command {cmd_name!r} not found. {self.install_instructions}

What it means

Raised by BaseTool.check_dependencies when a dependency declared with the cmd: or binary: prefix is not found on PATH via shutil.which. It surfaces as DependencyError with the tool's install_instructions appended, telling you exactly which external executable the tool needs and how to install it. check_available() catches this to report ToolStatus.UNAVAILABLE instead.

Source

Thrown at tools/base_tool.py:311

    # ---- Status reporting ----

    def get_status(self) -> ToolStatus:
        """Check if this tool's dependencies are satisfied."""
        try:
            self.check_dependencies()
            return ToolStatus.AVAILABLE
        except DependencyError:
            return ToolStatus.UNAVAILABLE

    def check_dependencies(self) -> None:
        """Verify all dependencies are installed. Raises DependencyError if not."""
        for dep in self.dependencies:
            if dep.startswith(("cmd:", "binary:")):
                prefix = "cmd:" if dep.startswith("cmd:") else "binary:"
                cmd_name = dep[len(prefix):]
                if shutil.which(cmd_name) is None:
                    raise DependencyError(
                        f"Command {cmd_name!r} not found. {self.install_instructions}"
                    )
            elif dep.startswith("env:"):
                env_name = dep[4:]
                if not os.environ.get(env_name):
                    raise DependencyError(
                        f"Environment variable {env_name!r} not set. {self.install_instructions}"
                    )
            elif dep.startswith("python:"):
                module_name = dep[7:]
                try:
                    __import__(module_name)
                except ImportError:
                    raise DependencyError(
                        f"Python module {module_name!r} not installed. {self.install_instructions}"
                    )

    def get_info(self) -> dict[str, Any]:

View on GitHub (pinned to 95e1c3d0ab)

Solutions

  1. Install the missing command (the install_instructions in the message name it), e.g. apt-get install -y ffmpeg
  2. If it is installed, ensure it is on PATH for the process: check shutil.which(cmd) in the same environment
  3. For services, set an absolute path by symlinking into /usr/local/bin or extending PATH in the service unit
  4. Call tool.check_available() first and degrade gracefully to ToolStatus.UNAVAILABLE instead of crashing

Example fix

# before: crash mid-run
result = tool.run(inputs)

# after: preflight
if tool.check_available() is not ToolStatus.AVAILABLE:
    raise SystemExit(f"tool unavailable: {tool.install_instructions}")
result = tool.run(inputs)
Defensive patterns

Strategy: validation

Validate before calling

import shutil
missing = [d[4:] for d in tool.dependencies if d.startswith(("cmd:", "binary:")) and shutil.which(d[4:]) is None]
if missing:
    raise SystemExit(f"install required commands: {missing} ({tool.install_instructions})")
# or use the built-in: assert tool.check_available() is ToolStatus.AVAILABLE

Type guard

def tool_commands_available(tool) -> bool:
    import shutil
    return all(shutil.which(d.split(":", 1)[1]) is not None
               for d in tool.dependencies if d.startswith(("cmd:", "binary:")))

Try / catch

from tools.base_tool import DependencyError
try:
    tool.check_dependencies()
except DependencyError as e:
    raise SystemExit(f"preflight failed: {e}") from e

Prevention

When it happens

Trigger: Any tool whose dependencies list contains e.g. 'cmd:ffmpeg' or 'binary:node' running on a machine where that executable is missing, not on PATH, or not executable. Common with fresh containers, minimal Docker images, or restricted sandboxes.

Common situations: ffmpeg/ffprobe absent in slim Docker images; node/npx missing on a Python-only host; PATH not including a user-local install (~/.local/bin, homebrew sbin) in a service context; running under systemd/cron with a minimal PATH.

Related errors


AI-assisted analysis of calesthio/OpenMontage@95e1c3d0ab (2026-08-15). Data as JSON: /api/errors/8624705edb03d43b. Report an issue: GitHub.