{"record":{"id":"0657bc74cd22521e","repo":"unicity-aos/aos-ce","slug":"capability-check-failed-for-uuid-e-denying","errorCode":null,"errorMessage":"capability check failed for {uuid}: {e}, denying","messagePattern":"capability check failed for (.+?): (.+?), denying","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"capsules/capsule-prompt-builder/src/lib.rs","lineNumber":435,"sourceCode":"    // sub drops here, releasing the kernel-side subscription.\n\n    runtime_log::info(format!(\n        \"Collected {} hook responses for request {}\",\n        sourced_responses.len(),\n        request.request_id\n    ));\n\n    // Cache capability results per-UUID to avoid redundant host function calls.\n    // Multiple hook responses can come from the same capsule.\n    let mut cache = std::collections::HashMap::<String, bool>::new();\n    filter_by_permission(sourced_responses, |source_id| {\n        let Some(uuid) = source_id else {\n            return false;\n        };\n        *cache.entry(uuid.to_owned()).or_insert_with(|| {\n            capabilities::check(uuid, \"allow_prompt_injection\")\n                .inspect_err(|e| {\n                    runtime_log::warn(format!(\"capability check failed for {uuid}: {e}, denying\"));\n                })\n                .unwrap_or(false)\n        })\n    })\n}\n\n/// Parse a single IPC message and extract hook responses with source capsule IDs.\nfn parse_hook_message(msg: &ipc::Message) -> Option<Vec<SourcedHookResponse>> {\n    let payload: serde_json::Value = match serde_json::from_str(&msg.payload) {\n        Ok(v) => v,\n        Err(e) => {\n            runtime_log::warn(format!(\"failed to deserialize hook response payload: {e}\"));\n            return None;\n        }\n    };\n\n    let source_id = if msg.source_id.is_empty() {\n        None","sourceCodeStart":417,"sourceCodeEnd":453,"githubUrl":"https://github.com/unicity-aos/aos-ce/blob/f6f22024fb1e8d122f28a1b4a9f75aee448ae839/capsules/capsule-prompt-builder/src/lib.rs#L417-L453","documentation":"capsule-prompt-builder checks, per source_id, whether the source has the 'allow_prompt_injection' capability via capabilities::check. If the check itself errors (as opposed to returning false), the result is denied (fail-closed), cached as false, and this warning is logged by fire_before_prompt_build during assemble.","triggerScenarios":"capabilities::check(uuid, \"allow_prompt_injection\") returns Err while building the per-uuid cache in fire_before_prompt_build — capability service unavailable, unknown uuid, or backend error resolving the source's capabilities.","commonSituations":"Capability store/registry outage; source uuid not yet registered; stale source_id from a removed capsule; permission configuration not yet propagated.","solutions":["Read the {e} detail and fix the capability backend availability or registration for that uuid.","Register the source capsule/uuid and grant 'allow_prompt_injection' explicitly if it should be allowed.","Clear the cached false entry (cache lives per assemble run) after fixing the backend and retry.","Confirm fail-closed is intended; if the source doesn't need injection, the warning can be ignored."],"exampleFix":"// before\ncapabilities::check(uuid, \"allow_prompt_injection\")\n    .inspect_err(|e| {\n        runtime_log::warn(format!(\"capability check failed for {uuid}: {e}, denying\"));\n    })\n    .unwrap_or(false)\n// after\n// register uuid in the capability store, then:\ncapabilities::check(uuid, \"allow_prompt_injection\")\n    .inspect_err(|e| {\n        runtime_log::warn(format!(\"capability check failed for {uuid}: {e}, denying\"));\n    })\n    .unwrap_or(false) // now returns Ok(true) for granted sources","handlingStrategy":"validation","validationCode":"// check capability registration before assemble\nconst registered = await capabilities.exists(uuid);\nif (!registered) throw new Error('source not registered: ' + uuid);","typeGuard":null,"tryCatchPattern":"capabilities::check(uuid, \"allow_prompt_injection\")\n    .inspect_err(|e| runtime_log::warn(\"capability check failed for {uuid}: {e}, denying\"))\n    .unwrap_or(false)","preventionTips":["Register sources and grant capabilities before assembly","Fail-closed is intended: treat warnings as config drift signals","Clear capability caches after fixing the backend"],"tags":["capability","permission","fail-closed","prompt-injection"],"backgroundTag":"permission-denied","analyzedSha":"f6f22024fb1e8d122f28a1b4a9f75aee448ae839","analyzedAt":"2026-09-13T03:04:44.565Z","contentChangedAt":"2026-09-13T03:04:44.565Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}