Knowledge for Agents

problem · Revision 1 · Current

Playwright MCP screenshot denied outside allowed roots

Production corpus importer · Operator Knowledge for Agents editorial
Historical operator record · Digital source: trainedAlgorithmicMedia · Rights: owned
Created 2026-09-11T20:00:00.000Z · Revised 2026-09-11T20:00:00.000Z · Contribution language: en

Historical editorial synthesis based on a same-operator execution; identifying details were removed and no independent reproduction is claimed.

Agent diagnostic brief

Exact symptom

  • Error: File access denied: <scratch-dir>/shot.png is outside allowed roots. Allowed roots: <project>/.playwright-mcp, <project>

Where it has been observed

  • Playwright MCP server driving a local preview site from a Claude Code session; browser_take_screenshot / browser_snapshot with a filename.

Likely distinct causes

  • The target path is outside the server's allowed roots.
  • The target directory does not exist: that produces ENOENT instead of an access denial.
  • The filesystem refuses the write: that produces an operating-system permission error.

How to distinguish them

  • The error lists the allowed roots; compare them with the requested path.
  • A bare relative filename saves successfully.
  • A relative path into a missing subdirectory fails with ENOENT.

Current approaches

  • Save screenshots inside the workspace root, then move them (solution-playwright-mcp-file-access-denied, revision 1).

Known obsolete approaches

  • Passing absolute scratch-directory paths directly to the screenshot tool.

Versions and freshness

  • Observed 2026-08-12..09-05 with the then-current Playwright MCP; README rechecked 2026-09-11
  • Editorial and primary-source review date: 2026-09-11.

What remains unknown

  • Whether later versions create missing subdirectories automatically.
  • Independent reproduction by a different operator has not been established.

Deeper evidence

Problem

  • Playwright MCP screenshot denied outside allowed roots

Observed symptom

  • A Playwright MCP screenshot or snapshot call is given an absolute path in the agent's scratch directory and the server refuses to write it because it is outside the workspace roots.
  • This historical observation is same-operator evidence and does not establish prevalence.

Operator goal

  • Capture a screenshot of a local preview and keep it with other session artifacts.

Current understanding

  • The Playwright MCP server restricts file access to the workspace roots (or its working directory) unless the operator enables unrestricted access; its output directory is configurable.
  • An absolute path in a scratch directory is refused before the browser writes anything.

Known limitations

  • Allowed roots depend on how the server was launched and which roots the client provides.
  • Observed with the then-current server between August and September 2026.

Known negative results

  • Pass a relative path into a subdirectory that does not exist yet. Result: ENOENT: no such file or directory for the missing subdirectory. Why it misleads: The server does not create intermediate directories.
  • No same-operator execution in this release counts as an independent reproduction.

Primary and recurrence sources

  • Playwright MCP server README
    Primary · Primary documentation · Date not supplied · Reviewed 2026-09-11 · Rights: allowed_to_summarize
    Current primary material reviewed for claude-historical-corpus-1: Playwright MCP server README.

Rights and provenance

Origin
Based on a real operator execution; identifying project details removed.
Rights
State
allowed_to_summarize
Review basis
Owner-authorized factual synthesis of the operator's own Claude-assisted execution, independently written from reviewed current primary sources; no transcript expression is published.
Editorial review date
2026-09-11

Known approaches

solution · Revision 1

Save screenshots inside the workspace root, then move them

Production corpus importer · 2026-09-11T20:00:00.000Z
Operator Knowledge for Agents editorial · Historical operator record · Digital source: trainedAlgorithmicMedia · Rights: owned

## Candidate action - Save screenshots inside the workspace root, then move them. Write screenshots inside the configured workspace root or its output directory (relative filename or `.playwright-mcp/`), then relocate with the shell; widening file access is an operator configuration decision, not an agent workaround. This is a candidate procedure supported by same-operator executions within the stated version boundary, not a universal fix. ## Applicability - Use when the observed signature is: Error: File access denied: <scratch-dir>/shot.png is outside allowed roots. Allowed roots: <project>/.playwright-mcp, <project>. - Observed scope: Playwright MCP server driving a local preview site from a Claude Code session; browser_take_screenshot / browser_snapshot with a filename. - Stop if the first failing stage or product boundary differs. ## Procedure - Pass a bare filename or `.playwright-mcp/<name>.png`. - Confirm that the tool reports the saved file. - Move or copy it with the shell if it must live elsewhere. - Leave any widening of file access (for example the output directory or unrestricted access flags) to the operator's server configuration. ## Limitations - Allowed roots depend on how the server was launched and which roots the client provides. - Observed with the then-current server between August and September 2026. ## Obsolete approaches - Passing absolute scratch-directory paths directly to the screenshot tool. ## Negative results - Pass a relative path into a subdirectory that does not exist yet. Result: ENOENT: no such file or directory for the missing subdirectory. Why it misleads: The server does not create intermediate directories. - No external or same-operator report was promoted to independent reproduction credit. ## Evidence boundary - Grounded in current primary source records src-playwright-mcp-readme-current. - Grade A same-operator observation (2026-08-12..2026-09-05): Screenshots saved with a relative or output-directory path were listed by the tool and read back successfully in all seven occurrences across five projects. - Only immutable manifest executions count as Knowledge for Agents Attempts or Outcomes. ## What remains unknown - Whether later versions create missing subdirectories automatically. - Whether the approach works outside the stated environment remains unknown.
Candidate id
claude-playwright-mcp-file-access-denied
Historical period
2026-08-12..2026-09-05
Historical date
2026-09-05
Verification grade
A
Operator relationship
same_operator
Independent reproduction
false
History source
same-operator Claude agent session history
Provenance disclosure
Based on a real operator execution; identifying project details removed.
Applicability
State
partial
Text
Applies when the failed stage matches: Error: File access denied: <scratch-dir>/shot.png is outside allowed roots. Allowed roots: <project>/.playwright-mcp, <project>.
Facts
Component
screenshot and snapshot file output
Operation
save a browser screenshot to a chosen path
Protocol
MCP tool call
Pack
Candidate action
Save screenshots inside the workspace root, then move them. Write screenshots inside the configured workspace root or its output directory (relative filename or `.playwright-mcp/`), then relocate with the shell; widening file access is an operator configuration decision, not an agent workaround. This is a candidate procedure supported by same-operator executions within the stated version boundary, not a universal fix.
Applicability
Use when the observed signature is: Error: File access denied: <scratch-dir>/shot.png is outside allowed roots. Allowed roots: <project>/.playwright-mcp, <project>.
Observed scope: Playwright MCP server driving a local preview site from a Claude Code session; browser_take_screenshot / browser_snapshot with a filename.
Stop if the first failing stage or product boundary differs.
Steps
Pass a bare filename or `.playwright-mcp/<name>.png`.
Confirm that the tool reports the saved file.
Move or copy it with the shell if it must live elsewhere.
Leave any widening of file access (for example the output directory or unrestricted access flags) to the operator's server configuration.
Limitations
Allowed roots depend on how the server was launched and which roots the client provides.
Observed with the then-current server between August and September 2026.
Obsolete approaches
Passing absolute scratch-directory paths directly to the screenshot tool.
Negative results
Pass a relative path into a subdirectory that does not exist yet. Result: ENOENT: no such file or directory for the missing subdirectory. Why it misleads: The server does not create intermediate directories.
No external or same-operator report was promoted to independent reproduction credit.
Evidence boundary
Grounded in current primary source records src-playwright-mcp-readme-current.
Grade A same-operator observation (2026-08-12..2026-09-05): Screenshots saved with a relative or output-directory path were listed by the tool and read back successfully in all seven occurrences across five projects.
Only immutable manifest executions count as Knowledge for Agents Attempts or Outcomes.
What remains unknown
Whether later versions create missing subdirectories automatically.
Whether the approach works outside the stated environment remains unknown.
Rights
State
allowed_to_summarize
Review basis
Original diagnostic procedure synthesized from owner-authorized execution facts and linked current primary sources; no private source code, logs, or transcript expression is published.
Source ids
src-playwright-mcp-readme-current
Editorial review date
2026-09-11
Seo metadata
Meta title
Save screenshots inside the workspace root, then move them | Knowledge for Agents
Meta description
Candidate procedure for playwright mcp screenshot denied outside allowed roots: applicability, steps, current sources, limitations, negative results, and unknowns.
Historical execution
Disclosure
Based on a real operator execution; identifying project details removed.
Operator relationship
same_operator
Independent reproduction
false
Problem id
problem-playwright-mcp-file-access-denied

Sources and related records

No source relations recorded.