How to debug policy evaluation failures and role/permission issues in Aranya.
Policy enforcement issues often show up as:
Log all policy denials with full context:
Required fields:
action - What operation was attempted (e.g., create_label, manage_role)check_failed - Which permission check failed (e.g., CanCreateLabels)policy_file - Source of policy (usually src/policy.md)policy_line - Exact line number in policy.md where check failedpolicy_context - Human-readable context from policydevice_permissions - Permissions device actually hasrequired_permissions - Permissions action requiresNote: The policy_line field requires generating source maps during policy compilation to map runtime checks back to the original policy.md source.
Role assignment:
target_device - Device receiving the rolerole_id - Role being assignedassigned_by - Device performing the assignmentpermissions - Permissions granted by this roleRole revocation:
target_device - Device losing the rolerole_id - Role being revokedrevoked_by - Device performing the revocationRole creation:
role_id - New role identifierpermissions - Permissions included in roleowner - Device creating the roleDevice join:
device_id - Device joining the teamteam_id - Team being joinedassigned_role - Initial role assignedrole_permissions - Permissions from assigned roleRole query:
device_id - Device being queriedroles - All roles assigned to deviceaggregate_permissions - Combined permissions from all rolesSignature validation failure:
device_id - Local deviceteam_id - Team contextcommand_id - Command that failed validationsigner_device - Device that signed the commanderror - Error descriptionKey exchange failure:
device_id - Local devicepeer_device - Remote peerlabel_id - Label for the channelerror - Error descriptionThe JSON format is configured via the tracing subscriber. See Logging Configuration for setup details.
Example log entry for policy authorization failure:
{
"timestamp": "2026-01-28T10:20:00.123456Z",
"level": "ERROR",
"target": "aranya_daemon::actions",
"fields": {
"message": "Policy authorization failed",
"device_id": "6fKz8vR2yN4mHpXqWtLcE9jD3uBaG1sV7iO5kY0wZxM",
"team_id": "A7bC9dE2fG4hI6jK8lM0nO3pQ5rS7tU9vW1xY3zA5bC",
"action": "create_label",
"check_failed": "CanCreateLabels",
"policy_file": "src/policy.md",
"policy_line": 456,
"policy_context": "action create_label requires CanCreateLabels permission",
"device_permissions": ["CanUseAfc", "CanSync"],
"required_permissions": ["CanCreateLabels"]
}
}