elastic/elasticsearch · warning · UnsupportedOperationException
sandbox_init(): {}
Error message
sandbox_init(): {} What it means
Thrown during macOS seatbelt sandbox setup in tryInstallExecSandbox() → initMacSandbox(). The code writes sandbox rules to a temp file and calls macLibc.sandbox_init(rulesPath, SANDBOX_NAMED, errorBuf). If sandbox_init returns non-zero, the OS-provided error message (e.g. syntax error in rules, unsupported operation) is extracted from errorBuf, freed via sandbox_free_error, and appended to this exception. This is the macOS equivalent of the Linux seccomp filter installation.
Source
Thrown at libs/native/src/main/java/org/elasticsearch/nativeaccess/MacNativeAccess.java:139
// write rules to a temporary file, which will be passed to sandbox_init()
Path rules;
try {
rules = createTempRulesFile();
Files.write(rules, Collections.singleton(SANDBOX_RULES));
} catch (IOException e) {
throw new UncheckedIOException(e);
}
try (Arena arena = Arena.ofConfined()) {
MemorySegment errorBuf = arena.allocate(ValueLayout.ADDRESS);
int ret = macLibc.sandbox_init(rules.toAbsolutePath().toString(), SANDBOX_NAMED, errorBuf);
// if sandbox_init() fails, add the message from the OS (e.g. syntax error) and free the buffer
if (ret != 0) {
MemorySegment errorPtr = errorBuf.get(ValueLayout.ADDRESS, 0);
String message = MemorySegmentAdapter.getString(errorPtr.reinterpret(Long.MAX_VALUE), 0);
macLibc.sandbox_free_error(errorPtr);
throw new UnsupportedOperationException("sandbox_init(): " + message);
}
logger.debug("OS X seatbelt initialization successful");
} finally {
IOUtils.deleteFilesIgnoringExceptions(rules);
}
}
private void initBsdSandbox() {
RLimit limit = libc.newRLimit();
limit.rlim_cur(0);
limit.rlim_max(0);
// not a standard limit, means something different on linux, etc!
final int RLIMIT_NPROC = 7;
if (libc.setrlimit(RLIMIT_NPROC, limit) != 0) {
throw new UnsupportedOperationException("RLIMIT_NPROC unavailable: " + libc.strerror(libc.errno()));
}
logger.debug("BSD RLIMIT_NPROC initialization successful");View on GitHub (pinned to db6a809a66)
Solutions
- Read the OS-provided error message appended after 'sandbox_init(): ' — it typically describes the specific syntax or policy error.
- Verify the macOS version is supported by this ES build.
- Check if SIP or an existing sandbox (e.g. running inside another sandboxed app) conflicts with seatbelt initialization.
- If running in a CI/test environment on macOS, try disabling the sandbox requirement.
- The sandbox_check at line 112 skips initialization if already sandboxed — verify that check is not being bypassed.
Defensive patterns
Strategy: try-catch
Try / catch
try {
nativeAccess.tryInstallExecSandbox();
} catch (UnsupportedOperationException e) {
// macOS sandbox_init() failed; the OS error message is appended.
logger.warn("macOS seatbelt sandbox unavailable: {}", e.getMessage());
} Prevention
- Run ES on supported macOS versions only — check the compatibility matrix.
- Verify SIP is not interfering with sandbox_init in your deployment environment.
- Check that the process is not already inside a conflicting sandbox (sandbox_check at line 112 should catch this).
- Read the OS-provided error message for specific syntax/policy errors.
When it happens
Trigger: Calling tryInstallExecSandbox() on macOS where macLibc.sandbox_init(rules.toAbsolutePath().toString(), SANDBOX_NAMED, errorBuf) returns non-zero. The OS error message from the errorBuf MemorySegment is appended to the exception string.
Common situations: macOS version incompatibility where the sandbox policy language or API has changed; SIP (System Integrity Protection) restrictions interfering with sandbox_init; corrupted or truncated SANDBOX_RULES constant string; running under an existing sandbox that conflicts; macOS beta releases with API changes.
Related errors
- RLIMIT_NPROC unavailable: {}
- seccomp unavailable: '{}' architecture unsupported
- seccomp unavailable: seccomp(BOGUS_OPERATION) returned {}
- seccomp(BOGUS_OPERATION): {}
- seccomp unavailable: seccomp(SECCOMP_SET_MODE_FILTER, BOGUS_
AI-assisted analysis of elastic/elasticsearch@db6a809a66 (2026-08-12).
Data as JSON: /api/errors/038a630660f86625.
Report an issue: GitHub.