Hmbown/CodeWhale · error · io::Error

secure external credential reads are unsupported on this…

Error message

secure external credential reads are unsupported on this platform

What it means

This error means secure external credential reading is only implemented for Unix and Windows; on any other target the cfg-gated stub always fails. The library throws it unconditionally from open_secure_regular_file when compiled for a platform that is neither unix nor windows.

Solutions

  1. Run Codewhale on a supported platform (Linux/macOS or Windows)
  2. Add a platform implementation of open_secure_regular_file for the target if you control the build
  3. Use a non-secure credential-read fallback path if one exists for the target
Defensive patterns

Strategy: fallback

Validate before calling

// compile-time guard
#[cfg(not(any(unix, windows)))]
compile_error!("secure external credentials require unix or windows");

Try / catch

match read_to_string(path) {
    Ok(s) => use_credential(&s),
    Err(e) if e.kind() == std::io::ErrorKind::Unsupported => {
        eprintln!("secure credential reads unsupported on this target");
    }
    Err(e) => return Err(e.into()),
}

Prevention

When it happens

Trigger: Calling read_to_string or read_codewhale_owned_to_string for an external credential file on a platform outside unix/windows (e.g. wasm, other exotic targets).

Common situations: Cross-compiling or running Codewhale on an unsupported OS target; embedding the TUI crate in a wasm or embedded host.

Understand the failure class

Background: "unsupported platform" / "not supported on this platform" errors: what they mean and how to fix them — this error's family across 47 libraries.

Related errors


AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22). Data as JSON: /api/errors/b008d858cd2cf460. Report an issue: GitHub.

Appendix: source

Thrown at crates/tui/src/external_credentials.rs:636

            continue;
        }
        let metadata = std::fs::symlink_metadata(&current)?;
        if metadata.file_attributes() & FILE_ATTRIBUTE_REPARSE_POINT != 0 {
            return Err(io::Error::new(
                io::ErrorKind::PermissionDenied,
                format!(
                    "external credential path contains reparse point {}",
                    codewhale_config::quote_os_path(&current)
                ),
            ));
        }
    }
    Ok(())
}

#[cfg(not(any(unix, windows)))]
fn open_secure_regular_file(_path: &Path, _require_owner_only: bool) -> io::Result<File> {
    Err(io::Error::new(
        io::ErrorKind::Unsupported,
        "secure external credential reads are unsupported on this platform",
    ))
}

#[cfg(test)]
pub(crate) fn reset_side_effect_trap() {
    SIDE_EFFECT_TRAP.with(|trap| trap.set([0; 5]));
}

#[cfg(test)]
#[must_use]
pub(crate) fn side_effect_trap_counts() -> (usize, usize) {
    SIDE_EFFECT_TRAP.with(|trap| {
        let counts = trap.get();
        (counts[0], counts[1])
    })
}

View on GitHub (pinned to 73e0f67d83)