langchain-ai/deepagents · error · OSError
temporary artifact permissions are too broad
Error message
temporary artifact permissions are too broad
What it means
Raised by `_allocate_temp_artifact` when, on POSIX (`os.name != 'nt'`), the temp artifact's mode grants any access to group or other (`stat.S_IMODE(st_mode) & 0o077` is nonzero). `mkstemp` creates files with mode 0600, so this signals the environment (typically the process umask or a temp filesystem) widened the permissions of the artifact.
Source
Thrown at libs/code/deepagents_code/auto_mode.py:1062
file_descriptor, raw_path = tempfile.mkstemp(
prefix=_TEMP_ARTIFACT_PREFIX,
suffix=suffix,
dir=temp_root,
)
file_path = Path(raw_path)
complete = False
try:
file_stat = _write_temp_artifact_bytes(file_descriptor, data)
if not stat.S_ISREG(file_stat.st_mode):
msg = "temporary artifact is not a regular file"
raise OSError(msg)
getuid = getattr(os, "getuid", None)
if callable(getuid) and file_stat.st_uid != getuid():
msg = "temporary artifact is not owned by this user"
raise OSError(msg)
if os.name != "nt" and stat.S_IMODE(file_stat.st_mode) & 0o077:
msg = "temporary artifact permissions are too broad"
raise OSError(msg)
artifact = AutoTempArtifact(
allocation_id=uuid4().hex,
file_path=str(file_path),
thread_key=thread_key,
turn_id=turn_id,
created_by_tool_call_id=tool_call_id,
file_device=file_stat.st_dev,
file_inode=file_stat.st_ino,
)
complete = True
return artifact
finally:
with contextlib.suppress(OSError):
os.close(file_descriptor)
if not complete:
with contextlib.suppress(OSError):
file_path.unlink()
View on GitHub (pinned to a1af029e6e)
Solutions
- Set a restrictive umask before running the agent (e.g. `umask 077` in the shell or service definition) and retry
- Check the temp filesystem for forced ACLs or mount masks (`getfacl` on the temp file, mount options) and correct them
- Point `TMPDIR` at a filesystem that honors 0600 creation modes and retry
- Verify no security software (AV, EDR, ACL daemons) is modifying file modes on creation
Defensive patterns
Strategy: validation
Validate before calling
import os, tempfile
fd, p = tempfile.mkstemp()
mode = os.stat(p).st_mode & 0o777
os.close(fd); os.unlink(p)
assert mode & 0o077 == 0, f"umask/filesystem yields broad modes: {oct(mode)}" Try / catch
try:
artifact = create_temp_artifact(content=content, suffix=".json")
except OSError as exc:
if "permissions are too broad" in str(exc):
set_umask_0o077_and_retry()
else:
raise Prevention
- Run agents with umask 077 in services, containers, and CI
- Check temp filesystems for forced ACLs or mount masks
- Avoid security tooling that widens modes on newly created files
- Prefer private per-user temp directories
When it happens
Trigger: Calling `create_temp_artifact` when the resulting temp file's mode is broader than 0600 — e.g. an unusual umask forcing extra bits, a temp filesystem (some containers, macOS default temp handling, or admin-configured mounts) that ORs in group/other permissions, or interception of the created file.
Common situations: Containers or CI images with a permissive umask (e.g. umask 000) that affects `mkstemp` behavior on certain filesystems; tmpfs mounts with forced ACLs/masks; security tooling that modifies newly created file modes.
Related errors
- temporary artifact is not owned by this user
- debug log directory is not owned by the current user: {path}
- Cannot determine whether {str(left)!r} is {str(right)!r}: {e
- temporary artifact is not a regular file
- temporary artifact identity changed
AI-assisted analysis of langchain-ai/deepagents@a1af029e6e (2026-08-29).
Data as JSON: /api/errors/03b8d6dcad961a0e.
Report an issue: GitHub.