alibaba/arthas · warning · IllegalAccessError
By default, strict mode is true, not allowed to set object p
Error message
By default, strict mode is true, not allowed to set object properties. Want to set object properties, execute `options strict false`
What it means
Thrown as IllegalAccessError by ArthasObjectPropertyAccessor.setPossibleProperty when GlobalOptions.strict is true (the default) and an OGNL expression tries to SET an object property (write). This is a deliberate safety guard: out-of-the-box Arthas forbids OGNL writes to objects to prevent accidental mutation of the live target application. The message itself (GlobalOptions.STRICT_MESSAGE) instructs the user how to opt out.
Source
Thrown at core/src/main/java/com/taobao/arthas/core/command/express/ArthasObjectPropertyAccessor.java:18
package com.taobao.arthas.core.command.express;
import java.util.Map;
import com.taobao.arthas.core.GlobalOptions;
import ognl.ObjectPropertyAccessor;
import ognl.OgnlException;
/**
* @author hengyunabc 2022-03-24
*/
public class ArthasObjectPropertyAccessor extends ObjectPropertyAccessor {
@Override
public Object setPossibleProperty(Map context, Object target, String name, Object value) throws OgnlException {
if (GlobalOptions.strict) {
throw new IllegalAccessError(GlobalOptions.STRICT_MESSAGE);
}
return super.setPossibleProperty(context, target, name, value);
}
}
View on GitHub (pinned to 21cf2e9ba5)
Solutions
- Explicitly disable strict mode: run `options strict false` before the mutating expression.
- Re-evaluate whether you really need to write — prefer read-only diagnostics; if you must mutate, accept the risk consciously.
- Re-enable strict after: `options strict true`.
Example fix
// before ognl '#this.enabled = true' // throws under strict mode // after options strict false ognl '#this.enabled = true' options strict true
Defensive patterns
Strategy: validation
Validate before calling
if (GlobalOptions.strict && expressionIsWrite(ognlExpr)) {
// either run `options strict false` or refrain from writing
} Type guard
static boolean isStrictWriteBlocked() { return GlobalOptions.strict; } Try / catch
try {
Object r = ognlEngine.get/setValue(...);
} catch (IllegalAccessError e) {
if (e.getMessage().equals(GlobalOptions.STRICT_MESSAGE)) {
// instruct user to `options strict false` if write is intentional
}
} Prevention
- Prefer read-only OGNL expressions for diagnostics.
- Consciously toggle `options strict false` only when mutation is intended, then re-enable.
- Document which expressions write so reviewers can catch accidental mutations.
When it happens
Trigger: Evaluate an OGNL expression that assigns to a property — e.g. '#this.field = x', 'target.foo = bar', or any lvalue assignment in watch/trace/ognl — while GlobalOptions.strict is at its default true.
Common situations: User attempts to mutate target state via ognl/watch without knowing strict mode is on; scripted diagnostics that try to flip a flag on the target; migrating from an older Arthas where strict was not enforced.
Related errors
- can not find arthas-core.jar under arthasHome: ${arthasHome}
- Task-aware tools registered but no TaskStore configured. Add
- Duplicate tool name: ${toolName}
- Could not find an available tcp port in the range [%d, %d] a
- '{s}' is not a valid size. Should be numeric value followed
AI-assisted analysis of alibaba/arthas@21cf2e9ba5 (2026-08-14).
Data as JSON: /api/errors/c7e203db3011be52.
Report an issue: GitHub.