unicity-aos/aos-ce · warning
hook-adapter-oracle: dropping invalid
Error message
hook-adapter-oracle: dropping invalid {expected.name()} hook '{event.event}': {reason} What it means
handle_oracle_hook validates each incoming hook event against the expected hook type via validate_oracle_hook, which returns a reason on failure (wrong event name, missing/invalid fields for that hook's schema). If validation fails, the event is dropped with this warning and Ok(()) is returned — the hook is a no-op rather than a panic or trap.
Solutions
- Inspect the warning's {reason} and {event.event} fields to see exactly which validation failed and fix the emitted hook payload.
- Verify the hook name registered in the tool config (codex/claude/grok settings) matches what the adapter's on_*_hook expects.
- Update the adapter or the producer so their hook schemas agree after any version upgrade.
- Test the hook payload with a minimal known-good example to isolate schema mismatch.
Example fix
// before (tool hook config)
{ "event": "oracle_query", "command": "capsule invoke ..." }
// after (match expected.name())
{ "event": "codex_oracle_query", "command": "capsule invoke ..." } Defensive patterns
Strategy: validation
Validate before calling
// Validate the hook payload before emitting it
fn valid_hook(event: &HookEvent, expected: &ExpectedHook) -> Result<(), String> {
if event.event != expected.name() { return Err(format!("event '{}' != '{}'", event.event, expected.name())); }
if event.payload.is_empty() { return Err("payload is empty".into()); }
Ok(())
} Try / catch
// Adapter already returns Ok(()) on invalid hooks; treat a logged drop as a no-op and re-dispatch a corrected event
if let Err(reason) = validate_oracle_hook(expected, &event) {
eprintln!("hook rejected: {reason}; fix payload and resend");
} Prevention
- Keep the hook event name in tool config in sync with the adapter's expected hook name.
- Validate payloads against the hook schema in CI with a unit test per hook type.
- After version upgrades, diff the hook schema between producer and adapter.
When it happens
Trigger: Raised in handle_oracle_hook (called from on_codex_hook, on_claude_hook, on_grok_hook) whenever validate_oracle_hook(expected, &event) returns Err: the event's 'event' field doesn't match the expected hook name, or required payload fields for that hook type are missing or malformed.
Common situations: A hook producer sends an event name that doesn't match the registered handler (typo, renamed hook after a version upgrade); a CLI/tool emits a hook payload schema the adapter doesn't recognize; wiring the same adapter to multiple hook entry points and sending the event to the wrong one.
Understand the failure class
Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.
Related errors
- canonical document exceeds bound
- must not be empty
- must be an absolute path
- bundled executable must have a parent directory
- AOS managed path must be a real directory
AI-assisted analysis of unicity-aos/aos-ce@f6f22024fb (2026-09-13).
Data as JSON: /api/errors/b07f4844efeff438.
Report an issue: GitHub.
Appendix: source
Thrown at capsules/capsule-hook-adapter-oracle/src/lib.rs:373
ipc::publish_json(&event_topic, &request)?;
collect_additional_context(&subscription, &reply_topic, &event.principal_id)
}
fn handle_oracle_hook(expected: Frontend, payload: serde_json::Value) -> Result<(), SysError> {
let event: OracleHookEvent = match serde_json::from_value(payload) {
Ok(event) => event,
Err(error) => {
log::warn(format!(
"hook-adapter-oracle: dropping malformed {} hook: {error}",
expected.name()
));
return Ok(());
}
};
let mapping = match validate_oracle_hook(expected, &event) {
Ok(mapping) => mapping,
Err(reason) => {
log::warn(format!(
"hook-adapter-oracle: dropping invalid {} hook '{}': {reason}",
expected.name(),
event.event
));
return Ok(());
}
};
let caller = runtime::caller()?;
if caller.principal.as_deref() != Some(event.principal_id.as_str()) {
log::warn(format!(
"hook-adapter-oracle: dropping principal mismatch for {}",
expected.name()
));
return Ok(());
}
let context = dispatch_oracle_hook(&event, mapping)?;
ipc::publish_json(View on GitHub (pinned to f6f22024fb)