{"record":{"id":"81b6e72c1781e76f","repo":"astrid-runtime/astrid","slug":"invaliddata-81b6e7","errorCode":"InvalidData","errorMessage":"captured Windows descendant has no final component","messagePattern":"captured Windows descendant has no final component","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/astrid-core/src/platform_fs/windows/path.rs","lineNumber":261,"sourceCode":"        // child mutations resolve relative to that boundary handle, so an\n        // ancestor rename cannot redirect the operation into another tree.\n        let result = Self {\n            components,\n            authority_boundary: path.to_path_buf(),\n        };\n        validate_trusted_parent_acl_handle(\n            result.authority_handle(),\n            &result.authority_boundary.display().to_string(),\n        )?;\n        Ok(result)\n    }\n\n    pub(super) fn verify(&self) -> io::Result<()> {\n        let mut parent_handle: Option<OwnedHandle> = None;\n        for component in &self.components {\n            let (handle, identity) = if let Some(parent) = &parent_handle {\n                let name = component.path.file_name().ok_or_else(|| {\n                    io::Error::new(\n                        io::ErrorKind::InvalidData,\n                        \"captured Windows descendant has no final component\",\n                    )\n                })?;\n                open_directory_identity_relative(parent.0, name, false)?\n            } else {\n                open_directory_identity(&component.path, true)?\n            };\n            if identity != component.identity {\n                return Err(io::Error::new(\n                    io::ErrorKind::PermissionDenied,\n                    format!(\n                        \"trusted Windows path changed during a security-sensitive operation: {}\",\n                        component.path.display()\n                    ),\n                ));\n            }\n            parent_handle = Some(handle);","sourceCodeStart":243,"sourceCodeEnd":279,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-core/src/platform_fs/windows/path.rs#L243-L279","documentation":"This InvalidData error is raised by `TrustedPathGuard::verify` while re-walking the captured component chain: when a component has a parent handle, verify derives its child name with `component.path.file_name()`, and if that returns None the captured component record is malformed — it has no final component to open handle-relatively. This indicates an internal invariant violation in how components were captured, not caller input.","triggerScenarios":"`verify` (called by `prepare_executable_transaction`, `acquire_named_private_lock`, `stage_transaction_copy_authenticated`, `stage_unique_bytes_with_share`, `verify_contract`) iterating a `LockedPathComponent` whose stored path equals the volume root or a prefix without a final component — i.e. a captured component recorded as the root such that `file_name()` is None while a parent handle exists.","commonSituations":"Practically only from an internal bug or memory/corruption of the guard: paths like `C:\\` being pushed as a non-first component, or a component path rebuilt with normalization that stripped the final name. Users hit it as an opaque failure during transaction staging on Windows.","solutions":["Treat this as a library bug: file an issue with the path passed to capture and the full error message.","As a workaround, re-create the guard (`TrustedPathGuard::capture`) freshly for the same directory and retry the operation.","Confirm your path has no trailing separators or root-only segments (`C:\\`, `C:\\.`) that could produce components without a file_name."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"match guard.verify() {\n    Err(e) if e.kind() == io::ErrorKind::InvalidData\n        && e.to_string().contains(\"no final component\") => {\n        // internal invariant violation: re-capture and retry once, else escalate\n        let guard = TrustedPathGuard::capture(&boundary)?;\n        guard.verify()?;\n    }\n    other => other?,\n}","preventionTips":["Treat this as a library bug: report it with the capture path and full error text.","Avoid paths with trailing separators or root-only segments that could produce malformed component records.","Re-create the guard freshly rather than reusing one that failed verification."],"tags":["windows","filesystem","internal-invariant"],"backgroundTag":"internal-invariant-violation","analyzedSha":"affd8760f44190dbdfbec23403f4c4b642c33112","analyzedAt":"2026-09-09T21:28:12.402Z","contentChangedAt":"2026-09-09T21:28:12.402Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}