egametang/ET · error · Exception
condition node owner key field not found: {node.GetType().Fu
Error message
condition node owner key field not found: {node.GetType().FullName}.{nameof(BTNumericCompare.OwnerKey)} What it means
Thrown by SetOwnerKeyField when the parser encountered the `OwnerKey.Variable` dotted syntax (e.g. `Unit1.HP > 0`) and the selected condition node has no public instance field named `OwnerKey`. The OwnerKey mechanism is what tells the runtime which entity the variable reads from, so its absence is fatal.
Source
Thrown at Packages/cn.etetet.conditionexpr/Scripts/Model/Share/ConditionExprParser.cs:286
}
private void SetCompareField(BTCondition node, string fieldName, object value)
{
FieldInfo fieldInfo = node.GetType().GetField(fieldName, BindingFlags.Instance | BindingFlags.Public);
if (fieldInfo == null)
{
throw new Exception($"condition node field not found: {node.GetType().FullName}.{fieldName}");
}
fieldInfo.SetValue(node, value);
}
private void SetOwnerKeyField(BTCondition node, string ownerKey)
{
FieldInfo fieldInfo = node.GetType().GetField(nameof(BTNumericCompare.OwnerKey), BindingFlags.Instance | BindingFlags.Public);
if (fieldInfo == null)
{
throw new Exception($"condition node owner key field not found: {node.GetType().FullName}.{nameof(BTNumericCompare.OwnerKey)}");
}
if (fieldInfo.FieldType != typeof(string))
{
throw new Exception($"condition node owner key field must be string: {node.GetType().FullName}.{nameof(BTNumericCompare.OwnerKey)}");
}
fieldInfo.SetValue(node, ownerKey);
}
private void SetParamsField(BTCondition node, string[] paramValues)
{
FieldInfo fieldInfo = node.GetType().GetField("Params", BindingFlags.Instance | BindingFlags.Public);
if (fieldInfo == null)
{
throw new Exception($"condition node params field not found: {node.GetType().FullName}.Params");
}
View on GitHub (pinned to 5cab01f7a8)
Solutions
- Add `public string OwnerKey;` to the custom node class.
- Ensure the entity whose key you write (e.g. `Unit1`) was registered via BTEnv.AddEntity(key, owner) at the call site.
- If the node never needs an owner, only ever reference it in the bare-variable form (no dot) so the parser does not call SetOwnerKeyField.
Example fix
// before
[ConditionVariable("HasBuff")]
public class HasBuffNode : BTCondition { /* no OwnerKey */ }
// used as: Tank.HasBuff > 0
// after
[ConditionVariable("HasBuff")]
public class HasBuffNode : BTCondition
{
public string OwnerKey;
} Defensive patterns
Strategy: type-guard
Type guard
static bool HasOwnerKeyField(Type t) =>
t.GetField("OwnerKey", BindingFlags.Instance | BindingFlags.Public) != null; Prevention
- Standardize a base class for custom condition nodes that includes `public string OwnerKey;`.
- Test nodes against both bare and dotted variable syntax.
- Add a compile-time/test-time scan ensuring OwnerKey exists on any node used with dotted references.
When it happens
Trigger: Using a `OwnerKey.Variable` reference against a custom [ConditionVariable] node that does not declare `public string OwnerKey`. Per AGENTS.md, OwnerKey must be a public string field on the node; using the dotted form with a node that lacks it triggers this.
Common situations: Reusing a numeric compare style for a non-numeric custom node and forgetting the OwnerKey field; renaming the field to `Owner`/`Target`; adding a new variable node but only testing the bare-variable form (`HP > 0`) which skips SetOwnerKeyField.
Related errors
- condition node field not found: {node.GetType().FullName}.{f
- condition node owner key field must be string: {node.GetType
- condition node params field not found: {node.GetType().FullN
- condition node params field must be string[]: {node.GetType(
- condition variable node create error: {nodeType.FullName}
AI-assisted analysis of egametang/ET@5cab01f7a8 (2026-08-13).
Data as JSON: /api/errors/1433ae4bc2e1f3ad.
Report an issue: GitHub.