vercel/turborepo · error · std::io::Error

invalid SID string from Windows: {e}

Error message

invalid SID string from Windows: {e}

What it means

sid_to_string (endpoint.rs:400 region) converts a SID with ConvertSidToStringSidW, walks the NUL-terminated wide string, and does String::from_utf16 on it. This InvalidData error means the SID string Windows returned was not valid UTF-16 (unpaired surrogates). ConvertSidToStringSidW only emits ASCII S-1-… strings, so this guards against corrupted output or memory trouble rather than any real SID state.

Source

Thrown at crates/turborepo-daemon/src/endpoint.rs:400

    }

    fn sid_to_string(sid: PSID) -> Result<String, std::io::Error> {
        let mut string_sid = ptr::null_mut();
        if unsafe { ConvertSidToStringSidW(sid, &mut string_sid) } == 0 {
            return Err(std::io::Error::last_os_error());
        }
        let string_sid = LocalStringSid(string_sid);
        let len = unsafe {
            let mut len = 0;
            while *string_sid.0.add(len) != 0 {
                len += 1;
            }
            len
        };
        let slice = unsafe { std::slice::from_raw_parts(string_sid.0, len) };

        String::from_utf16(slice).map_err(|e| {
            std::io::Error::new(
                std::io::ErrorKind::InvalidData,
                format!("invalid SID string from Windows: {e}"),
            )
        })
    }

    fn wide_null(value: &OsStr) -> Vec<u16> {
        value.encode_wide().chain(std::iter::once(0)).collect()
    }

    struct Sid {
        _buffer: Vec<usize>,
        sid: PSID,
    }

    impl Sid {
        fn as_ptr(&self) -> PSID {
            self.sid

View on GitHub (pinned to f9245100cf)

Solutions

  1. Restart the machine / rerun the daemon once
  2. Check for security software injecting into the process
  3. If reproducible, capture a crash dump and file a bug — the guard exists to detect the impossible
Defensive patterns

Strategy: try-catch

Try / catch

// invariant guard: any occurrence is a bug — capture and report, do not retry
Err(e) if e.kind() == std::io::ErrorKind::InvalidData && e.to_string().contains("SID string") => {
    capture_and_report(e); // includes path + os version
}

Prevention

When it happens

Trigger: No realistic input triggers it; it would require ConvertSidToStringSidW returning garbage — memory corruption, a broken security DLL, or an OS/API contract violation during daemon startup.

Common situations: Not observed in practice; if seen, suspect the process environment (injected DLLs, sandbox) rather than configuration

Related errors


AI-assisted analysis of vercel/turborepo@f9245100cf (2026-08-17). Data as JSON: /api/errors/87f305dfa203826a. Report an issue: GitHub.