zeroclaw-labs/zeroclaw · error · anyhow::Error

Screenshot path ' ' resolves to ' ' which is outside the…

Error message

Screenshot path '{ $path }' resolves to '{ $canonical }' which is outside the workspace

What it means

The screenshot path's parent directory was canonicalized and resolved outside the allowed workspace root (both the requested and canonical path are shown, typically via symlinks or .. components). Writing there would escape the tool's filesystem sandbox.

Solutions

  1. Use a screenshot path that resolves inside the workspace; remove symlinks/traversal pointing outside.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/zeroclaw-tools/src/browser.rs:891 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of zeroclaw-labs/zeroclaw@88bb9c8533 (2026-08-23). Data as JSON: /api/errors/c931e530552c6f7e. Report an issue: GitHub.

Appendix: source

Thrown at crates/zeroclaw-tools/src/browser.rs:891

        let canonical = tokio::fs::canonicalize(parent).await.with_context(|| {
            crate::i18n::get_required_tool_string_with_args(
                "tool-browser-screenshot-error-parent-not-exist",
                &[
                    ("path", raw_path),
                    ("parent", &parent.display().to_string()),
                ],
            )
        })?;

        if !self.security.is_resolved_path_allowed(&canonical) {
            let msg = crate::i18n::get_required_tool_string_with_args(
                "tool-browser-screenshot-error-path-outside-workspace",
                &[
                    ("path", raw_path),
                    ("canonical", &canonical.display().to_string()),
                ],
            );
            anyhow::bail!("{msg}");
        }

        // Build the final *target* path (parent + file name) so we can apply
        // the same target-level guards the file_write / file_edit tools use.
        let Some(file_name) = full.file_name() else {
            let msg = crate::i18n::get_required_tool_string_with_args(
                "tool-browser-screenshot-error-missing-filename",
                &[("path", raw_path)],
            );
            anyhow::bail!("{msg}");
        };
        let resolved_target = canonical.join(file_name);

        if self.security.is_runtime_config_path(&resolved_target) {
            let msg = crate::i18n::get_required_tool_string_with_args(
                "tool-browser-screenshot-error-runtime-config-target",
                &[
                    ("path", raw_path),

View on GitHub (pinned to 88bb9c8533)