run-llama/llama_index · error · PermissionError
Query rejected: {verification.reason}
Error message
Query rejected: {verification.reason} What it means
Raised by AgentMeshQueryEngine.query (sync path) when invoker verification ran but came back untrusted (verification.trusted is false) and the policy is set to block unverified callers (policy.block_unverified=True). The f-string embeds verification.reason explaining why trust failed; when audit_queries is enabled a blocked-query audit record is appended to the audit log before the PermissionError propagates.
Source
Thrown at llama-index-integrations/agent/llama-index-agent-agentmesh/llama_index/agent/agentmesh/query_engine.py:168
# Verify invoker if required
if self._policy.require_verification:
if not invoker_card:
if self._data_policy.require_identity:
raise PermissionError(
"Query requires invoker identity but none provided"
)
else:
verification = self.verify_invoker(invoker_card)
if not verification.trusted and self._policy.block_unverified:
# Log blocked query
if self._policy.audit_queries:
record = self._create_audit_record(
query_text, invoker_card, verification
)
record.warnings.append("Query blocked due to trust failure")
self._audit_log.append(record)
raise PermissionError(f"Query rejected: {verification.reason}")
# Execute the underlying query
response = self._query_engine.query(query_bundle)
# Audit if required
if self._policy.audit_queries:
# Count results (simplified)
result_count = 1 if response else 0
record = self._create_audit_record(
query_text, invoker_card, verification, result_count
)
self._audit_log.append(record)
return response
async def _aquery(
self,
query_bundle: QueryBundle,View on GitHub (pinned to afd0fef371)
Solutions
- Inspect verification.reason (and the engine's audit log) to identify the exact trust failure, then fix the card (renew, re-sign with a trusted issuer, fix clock skew)
- Add the invoker's issuer/CA to the engine's trusted-verifier configuration
- Only if deliberate: build the engine with block_unverified=False so untrusted invokers are allowed but audited
Example fix
# before resp = engine.query(q, invoker_card=stale_card) # PermissionError: Query rejected: ... # after fresh_card = identity.refresh_card() # re-signed / renewed credential resp = engine.query(q, invoker_card=fresh_card)
Defensive patterns
Strategy: try-catch
Validate before calling
def invoker_trusted(engine, card) -> bool:
if card is None:
return False
return engine.verify_invoker(card).trusted Try / catch
try:
resp = engine.query(q, invoker_card=card)
except PermissionError as e:
reason = str(e).removeprefix("Query rejected: ")
logger.warning("untrusted invoker blocked: %s", reason)
if engine._policy.audit_queries:
dump_audit_log(engine) # record already appended by the engine
raise Prevention
- Verify cards with engine.verify_invoker(card) and surface the reason before querying
- Automate credential renewal before expiry in long-running services
- Keep the engine's trusted-issuer list in sync with mesh key rotations; review the audit log for blocked queries
When it happens
Trigger: Calling engine.query(..., invoker_card=card) where verify_invoker(card) returns trusted=False — expired card, untrusted issuer, bad signature — while policy.require_verification=True and policy.block_unverified=True. The raise happens only in the invoker_card-present branch, after the audit record is written.
Common situations: Expired or rotated invoker credentials; agent card signed by a CA/issuer not in the engine's trust store; clock skew making a validity window appear expired; strict production policy (block_unverified=True) applied to dev agents with self-signed cards.
Related errors
- Query requires invoker identity but none provided
- code_execute_fn must be provided for CodeActAgent
- This query engine does not support retrieve, use query direc
- This query engine does not support synthesize, use query dir
- This query engine does not support asynthesize, use aquery d
AI-assisted analysis of run-llama/llama_index@afd0fef371 (2026-08-15).
Data as JSON: /api/errors/d5dc876e6b9b8369.
Report an issue: GitHub.