toeverything/AFFiNE · error · napi::Error
unsupported permission evaluation input version
Error message
unsupported permission evaluation input version: {} What it means
Version check at the entry of evaluate_permission: the PermissionEvaluationInputV1 version does not match the actions module VERSION the native evaluator was compiled for, so evaluation is refused rather than misinterpreting an incompatible input shape.
Solutions
- Pass a supported permission evaluation input version.
- Upgrade the evaluator or downgrade the input payload.
Defensive patterns
Strategy: validation
When it happens
Trigger: Raised at the start of evaluate_permission when input.version does not match the VERSION constant supported by this evaluator build.
Common situations: The frontend and native module disagree on the permission input schema version. Upgrade the native package so both sides use the same version.
AI-assisted analysis of toeverything/AFFiNE@b4c8548c09 (2026-08-18).
Data as JSON: /api/errors/132cf22e9432e3a7.
Report an issue: GitHub.
Appendix: source
Thrown at packages/backend/native/src/permission/evaluator.rs:14
use super::{
actions::VERSION,
candidates::{
best_doc_role, decide, decide_doc, doc_candidates, parse_workspace_role, role_name, workspace_candidates,
},
types::{
PermissionDocEvaluationOutputV1, PermissionEvaluationInputV1, PermissionEvaluationOutputV1,
PermissionWorkspaceEvaluationOutputV1,
},
};
pub fn evaluate_permission(input: PermissionEvaluationInputV1) -> anyhow::Result<PermissionEvaluationOutputV1> {
if input.version != VERSION {
anyhow::bail!("unsupported permission evaluation input version: {}", input.version);
}
let workspace_candidates = workspace_candidates(&input)?;
let workspace_decisions = input
.workspace_actions
.iter()
.map(|action| decide(&input, action, &workspace_candidates))
.collect::<Vec<_>>();
let workspace_effective_role = workspace_candidates
.iter()
.filter_map(|candidate| parse_workspace_role(&candidate.role).ok())
.max()
.map(role_name);
let workspace_resource_owner_role = workspace_candidates
.iter()
.any(|candidate| candidate.owner)
.then(|| "owner".to_string());
View on GitHub (pinned to b4c8548c09)