Hmbown/CodeWhale · error · anyhow::Error

is a symbolic link, not a workspace-owned file

Error message

{} is a symbolic link, not a workspace-owned file

What it means

On platforms other than unix/windows, open_workspace_dotenv_without_following_links inspects symlink_metadata; if the path itself is a symbolic link, it bails because a symlinked .env could point outside the workspace and swap targets after validation. Only a plain, self-owned regular file is accepted as a credential source.

Solutions

  1. Replace the symlink with a real copy of the target file inside the workspace.
  2. Check with `ls -la .env` / `readlink .env` and remove the link, then `cp` the content in.
  3. Configure your dotfiles/secret manager to write real files in the workspace instead of symlinks.
  4. If you believe this platform is unsupported for this path, run on a supported platform (unix/windows) where O_NOFOLLOW-style secure open is used.

Example fix

// before
ln -s /home/user/.secrets/codewhale.env .env
// after
rm .env && cp /home/user/.secrets/codewhale.env .env
Defensive patterns

Strategy: validation

Validate before calling

// shell
[ ! -L .env ] || { echo '.env must not be a symlink'; exit 1; }

Prevention

When it happens

Trigger: Running Codewhale on a non-unix/non-windows platform where the workspace `.env` is a symbolic link to another file.

Common situations: Symlinking .env from a shared secrets directory or dotfiles manager on an unusual platform (e.g. wasm/other targets), or a tool that materializes config as symlinks.

Understand the failure class

Background: Path traversal blocked: "path escapes the workspace" and "outside site root" errors when a path will not stay inside its allowed directory — this error's family across 26 libraries.

Related errors


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

Appendix: source

Thrown at crates/tui/src/lib.rs:3054

        .map_err(|error| anyhow!("could not securely open {}: {error}", path.display()))?;
    let metadata = file
        .metadata()
        .map_err(|error| anyhow!("could not inspect {}: {error}", path.display()))?;
    if metadata.file_attributes() & FILE_ATTRIBUTE_REPARSE_POINT != 0 {
        bail!(
            "{} is a reparse point, not a workspace-owned file",
            path.display()
        );
    }
    Ok(file)
}

#[cfg(not(any(unix, windows)))]
fn open_workspace_dotenv_without_following_links(path: &Path) -> Result<std::fs::File> {
    let metadata = std::fs::symlink_metadata(path)
        .map_err(|error| anyhow!("could not inspect {}: {error}", path.display()))?;
    if metadata.file_type().is_symlink() {
        bail!(
            "{} is a symbolic link, not a workspace-owned file",
            path.display()
        );
    }
    std::fs::File::open(path)
        .map_err(|error| anyhow!("could not securely open {}: {error}", path.display()))
}

/// Generate shell completions for the given shell
fn generate_completions(shell: Shell) {
    let mut cmd = Cli::command();
    let name = cmd.get_name().to_string();
    generate(shell, &mut cmd, name, &mut io::stdout());
}

/// Run the offline evaluation harness (no network/LLM calls).
fn run_eval(args: EvalArgs) -> Result<()> {
    let fail_step = match args.fail_step.as_deref() {

View on GitHub (pinned to 73e0f67d83)