oraios/serena · error · FileNotFoundError

WolframKernel not found. Please either: 1. Set the {WOLFRAM_

Error message

WolframKernel not found. Please either:
1. Set the {WOLFRAM_PATH_ENV_VAR} environment variable to your Wolfram installation
2. Add WolframKernel to your system PATH
3. Configure ls_path in ls_specific_settings.wolfram
4. Install Wolfram Mathematica (13.0+) or Wolfram Engine (12.1+) from https://www.wolfram.com/

What it means

Thrown as FileNotFoundError by _find_wolfram_kernel when no WolframKernel executable can be located. Unlike npm-based servers, the Wolfram integration cannot auto-install the kernel; it searches the env-var path, PATH, and ls_path config, and fails with a checklist of remedies.

Source

Thrown at src/solidlsp/language_servers/wolfram_language_server.py:151

            "/usr/local/Wolfram/Mathematica/*/Executables/WolframKernel",
            "/usr/local/Wolfram/WolframEngine/*/Executables/WolframKernel",
            "/opt/Wolfram/Mathematica/*/Executables/WolframKernel",
        ]:
            search_locations.extend(sorted(glob.glob(pattern), reverse=True))

    elif system == "Windows":
        for pattern in [
            "C:\\Program Files\\Wolfram Research\\Mathematica\\*\\WolframKernel.exe",
            "C:\\Program Files\\Wolfram Research\\Wolfram Engine\\*\\WolframKernel.exe",
        ]:
            search_locations.extend(sorted(glob.glob(pattern), reverse=True))

    for location in search_locations:
        if os.path.isfile(location) and os.access(location, os.X_OK):
            log.info(f"Found WolframKernel at: {location}")
            return location

    raise FileNotFoundError(
        "WolframKernel not found. Please either:\n"
        f"1. Set the {WOLFRAM_PATH_ENV_VAR} environment variable to your Wolfram installation\n"
        "2. Add WolframKernel to your system PATH\n"
        "3. Configure ls_path in ls_specific_settings.wolfram\n"
        "4. Install Wolfram Mathematica (13.0+) or Wolfram Engine (12.1+) from https://www.wolfram.com/"
    )


def _find_kernel_in_install_dir(install_dir: str) -> str | None:
    """Try to locate WolframKernel within a Wolfram installation directory."""
    system = platform.system()

    if system == "Darwin":
        candidates = [
            os.path.join(install_dir, "Contents", "MacOS", "WolframKernel"),
            os.path.join(install_dir, "MacOS", "WolframKernel"),
        ]
    elif system == "Windows":

View on GitHub (pinned to 7fcbca7e62)

Solutions

  1. Set the WOLFRAM_PATH env var (WOLFRAM_PATH_ENV_VAR) to the full path of the WolframKernel executable.
  2. Find the kernel and expose it: e.g. ln -s '/Applications/Mathematica.app/Contents/MacOS/WolframKernel' /usr/local/bin/ or add its dir to PATH.
  3. Set ls_path in ls_specific_settings.wolfram to the kernel executable path.
  4. If no Wolfram product exists, install Wolfram Mathematica 13.0+ or the free Wolfram Engine 12.1+ from https://www.wolfram.com/.
  5. chmod +x the kernel binary if it exists but is not executable.

Example fix

// before
# WolframKernel not on PATH; server startup fails
// after
import os
os.environ["WOLFRAM_KERNEL_PATH"] = "/Applications/Mathematica.app/Contents/MacOS/WolframKernel"  # then construct the server
Defensive patterns

Strategy: fallback

Validate before calling

import os, shutil
def find_wolfram_kernel() -> str | None:
    p = os.environ.get("WOLFRAM_KERNEL_PATH") or shutil.which("WolframKernel")
    if p and os.path.isfile(p) and os.access(p, os.X_OK):
        return p
    return None
if find_wolfram_kernel() is None:
    raise SystemExit("Install Wolfram or set WOLFRAM_KERNEL_PATH before starting the server")

Type guard

def is_wolfram_kernel(path: str | None) -> bool:
    return bool(path) and os.path.isfile(path) and os.access(path, os.X_OK)

Try / catch

try:
    ls = SolidLSP("wolfram", repo_path)
except FileNotFoundError as e:
    if "WolframKernel not found" in str(e):
        # skip Wolfram indexing or guide the user through installation
        log.warning("Wolfram analysis disabled: %s", e)
    else:
        raise

Prevention

When it happens

Trigger: Starting the Wolfram language server calls _find_wolfram_kernel (from _get_or_install_core_dependency or _determine_disabled_language_servers); none of the searched locations is an executable file (isfile + X_OK).

Common situations: Wolfram/Mathematica not installed at all; Wolfram installed in a nonstandard location (e.g. custom install dir, Homebrew Cask); kernel binary exists but lacks execute permission; env var set to the Wolfram app directory rather than the kernel binary.

Related errors


AI-assisted analysis of oraios/serena@7fcbca7e62 (2026-08-29). Data as JSON: /api/errors/9c010c153cbb07e7. Report an issue: GitHub.